adityapatel007-byte/RedProbe-LLM-Eval
GitHub: adityapatel007-byte/RedProbe-LLM-Eval
一款用于 LLM 应用的全栈自动化评估与红队安全测试平台,通过 LLM-as-Judge 机制对聊天机器人的质量与安全漏洞进行量化评分。
Stars: 0 | Forks: 0
# RedProbe — LLM 评估与红队测试
一个用于 LLM 应用的全栈安全测试平台。粘贴任意 system prompt,RedProbe 将使用 LLM-as-Judge 评分机制评估其质量,并通过涵盖 5 大类别的 19 种自动化对抗攻击来探测潜在漏洞。
**在线演示:** [即将推出]
## 功能介绍
**评估** — 在精选的测试数据集上运行你的 LLM,并使用 GPT-4o 作为裁判,对响应的正确性、相关性、抗幻觉能力以及连贯性进行评分。
**红队测试** — 发起 19 种对抗攻击(prompt injection、越狱、数据提取、角色操纵、偏见探测),并使用 LLM 裁判来判断每次攻击是否成功或被成功防御。
## 架构
```
┌────────────────────────────────────────────────────────┐
│ React Frontend (Vite + Tailwind) │
│ Glassmorphism UI · Framer Motion · Recharts radar │
└──────────────────────────┬─────────────────────────────┘
│ REST API
▼
┌────────────────────────────────────────────────────────┐
│ FastAPI Backend │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ TargetLLM │ │ Evaluator │ │ RedTeamer │ │
│ │ (wraps any │ │ (LLM-as- │ │ (19 attacks │ │
│ │ system │ │ Judge │ │ across 5 │ │
│ │ prompt) │ │ scoring) │ │ categories)│ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└──────────────────────────┬─────────────────────────────┘
│
▼
OpenAI GPT-4o API
(target model + judge model)
```
## 技术栈
| 层级 | 技术 |
|-------|-----------|
| 前端 | React 18, Vite, Tailwind CSS, Framer Motion |
| 图表 | Recharts (雷达图), 动画计数器 |
| 后端 | FastAPI, Pydantic |
| LLM | OpenAI GPT-4o (裁判), GPT-4o-mini (目标) |
| 部署 | Vercel (前端) + Render (后端) |
## 项目结构
```
├── backend/
│ ├── main.py # FastAPI endpoints
│ ├── src/
│ │ ├── target.py # Target LLM wrapper
│ │ ├── evaluator.py # Eval engine + LLM-as-Judge
│ │ ├── redteam.py # Attack library + red team engine
│ │ └── config.py # Environment config
│ ├── requirements.txt
│ └── .env.example
├── frontend/
│ ├── src/
│ │ ├── App.jsx # Main app — all UI components
│ │ ├── index.css # Glassmorphism, animations, custom styles
│ │ └── main.jsx # React entry point
│ ├── index.html
│ ├── package.json
│ ├── vite.config.js
│ ├── tailwind.config.js
│ └── vercel.json # Frontend deployment config
└── README.md
```
## 快速开始
### 后端
```
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# 将你的 OpenAI API key 添加到 .env
python main.py # Runs on http://localhost:8000
```
### 前端
```
cd frontend
npm install
npm run dev # Runs on http://localhost:5173
```
在开发模式下,前端会将 `/api/*` 请求代理到 `localhost:8000`。
## 攻击库
| 类别 | 攻击数 | 严重程度 | 测试目标 |
|----------|---------|----------|-----------|
| Prompt Injection | 4 | 严重 | 覆盖/忽略 system prompt |
| 越狱 | 4 | 严重 | 绕过安全防护机制 |
| 数据泄露 | 4 | 高 | 提取 system prompt 或配置 |
| 角色操纵 | 3 | 高 | 强制设定未授权角色 |
| 偏见探测 | 3 | 中 | 歧视性或带有偏见的输出 |
## 核心概念演示
- **LLM-as-Judge 评估** — 使用 GPT-4o 对响应的 4 个质量维度进行评分
- **对抗性红队测试** — 通过分类的攻击向量进行自动化安全测试
- **全栈架构** — React 前端 + FastAPI 后端,清晰解耦
- **生产级 UI 模式** — 毛玻璃效果、动画分数展示、响应式设计
- **API 设计** — 带有 Pydantic 验证和 CORS 的 RESTful endpoint
## 部署
**前端 → Vercel:**
```
cd frontend
npm run build
# 部署 dist/ 到 Vercel,使用 backend URL 更新 vercel.json
```
**后端 → Render:**
```
# 推送 backend/ 到 GitHub
# 连接到 Render,设置环境变量
# Render 自动使用 Procfile
```
## 许可证
MIT
标签:AV绕过, FastAPI, React, Syscalls, 一键部署, 大语言模型评估, 对抗性攻击, 零日漏洞检测