# African Trust & Safety LLM Challenge — Red-Team Tool
A web-based tool for the Zindi African Trust & Safety LLM Challenge. Load African language LLMs locally, craft adversarial prompts, validate safety breaks, and export structured submissions.
## Features
- **Local Model Loading** — Load African language LLMs (Swahili, Hausa, Yoruba, Amharic) directly on your GPU via HuggingFace Transformers
- **Streaming Generation** — Real-time token streaming with SSE
- **Refusal Detection** — Automatic detection of model refusals using multilingual keyword matching
- **Validation Runs** — Run prompts multiple times (up to 10×) to confirm break reproducibility
- **Break Database** — SQLite-backed storage for confirmed safety breaks with full CRUD
- **Taxonomy System** — Attack types, risk categories, and subcategories from the challenge spec
- **AI-Powered Features** (optional, requires OpenAI API key):
- Prompt optimization
- Auto-categorization of attacks
- Contextual note generation
- Translation between languages
- **Export** — Generate Zindi-format markdown submissions from saved breaks
## Requirements
- **Python 3.10+**
- **NVIDIA GPU** with CUDA support (models run on GPU)
- ~4-8 GB VRAM depending on the model
## Setup
1. **Clone the repo**
```bash
git clone
github.com
cd The-African-Trust-Safety-LLM-Challenge
```
2. **Install dependencies**
```bash
pip install -r requirements.txt
```
3. **Run the app**
```bash
python run_webapp.py
```
Opens automatically at
127.0.0.1
## Usage
1. **Load a model** — Select a model from the top bar dropdown and click "Load". The model downloads from HuggingFace on first use.
2. **Write a prompt** — Type your adversarial prompt in the Prompt Lab (in the target language).
3. **Run** — Click "Run" for streaming generation, or "Validate 3×" to confirm reproducibility.
4. **Save breaks** — When you find a safety failure, click "Save Break" to store it with m …