Add Space configuration
Browse files
README.md
CHANGED
|
@@ -1,202 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
- runnable model adapters for `mock`, `groq`, and `ollama`
|
| 14 |
-
- category-aware evaluation and scoring
|
| 15 |
-
- a mitigation layer integrated into the runner
|
| 16 |
-
- baseline-vs-defended comparison workflows
|
| 17 |
-
- a lightweight Streamlit dashboard for presenting results
|
| 18 |
-
|
| 19 |
-
This is a capstone evaluation framework, not a production security product.
|
| 20 |
-
|
| 21 |
-
## Scope
|
| 22 |
-
|
| 23 |
-
### In scope
|
| 24 |
-
|
| 25 |
-
- attack scenario design and normalization
|
| 26 |
-
- LLM vulnerability evaluation
|
| 27 |
-
- mitigation implementation
|
| 28 |
-
- comparative measurement and reporting
|
| 29 |
-
|
| 30 |
-
### Out of scope
|
| 31 |
-
|
| 32 |
-
- training new foundation models
|
| 33 |
-
- building a consumer chatbot product
|
| 34 |
-
- large-scale model training infrastructure
|
| 35 |
-
|
| 36 |
-
## Repository Structure
|
| 37 |
-
|
| 38 |
-
- `src/prompt_injection_framework/attacks/`: attack logic and generators
|
| 39 |
-
- `src/prompt_injection_framework/mitigations/`: request and response defenses
|
| 40 |
-
- `src/prompt_injection_framework/models/`: model adapters
|
| 41 |
-
- `src/prompt_injection_framework/evaluation/`: scoring and metrics
|
| 42 |
-
- `src/prompt_injection_framework/orchestration/`: experiment runner and config loading
|
| 43 |
-
- `configs/`: runnable experiment configurations
|
| 44 |
-
- `dashboard/`: Streamlit demo app
|
| 45 |
-
- `tests/`: automated validation
|
| 46 |
-
- `docs/`: project, methodology, and workflow documentation
|
| 47 |
-
|
| 48 |
-
## Active Data State
|
| 49 |
-
|
| 50 |
-
- Active normalized sources:
|
| 51 |
-
- HackAPrompt: `1,000` curated cases
|
| 52 |
-
- TensorTrust: `1,346` curated cases
|
| 53 |
-
- Active corpus files:
|
| 54 |
-
- `data/normalized/attack_cases.jsonl`
|
| 55 |
-
- `data/normalized/attack_cases.enriched.jsonl`
|
| 56 |
-
- Total active normalized corpus:
|
| 57 |
-
- `2,346` cases
|
| 58 |
-
|
| 59 |
-
AgentDojo remains a reference source but is not part of the active experiment
|
| 60 |
-
corpus in the current project state.
|
| 61 |
-
|
| 62 |
-
## Supported Model Providers
|
| 63 |
-
|
| 64 |
-
- `mock`
|
| 65 |
-
- for fast validation and testing
|
| 66 |
-
- `groq`
|
| 67 |
-
- for hosted real-model experiments
|
| 68 |
-
- `ollama`
|
| 69 |
-
- for local/open-source model experiments
|
| 70 |
-
|
| 71 |
-
More detail is documented in `docs/PHASE4_BASELINE_MODELS.md`.
|
| 72 |
-
|
| 73 |
-
## Execution Pipeline
|
| 74 |
-
|
| 75 |
-
1. Load normalized cases
|
| 76 |
-
2. Filter and sample the experiment slice
|
| 77 |
-
3. Map cases into taxonomy-aware experiment records
|
| 78 |
-
4. Build model requests
|
| 79 |
-
5. Apply mitigation if enabled
|
| 80 |
-
6. Run the model or mitigation block path
|
| 81 |
-
7. Apply response mitigation
|
| 82 |
-
8. Score outputs
|
| 83 |
-
9. Save manifest, case results, and summary artifacts
|
| 84 |
-
|
| 85 |
-
## Quick Start
|
| 86 |
-
|
| 87 |
-
### Environment setup
|
| 88 |
-
|
| 89 |
-
```bash
|
| 90 |
-
python3 -m venv .venv
|
| 91 |
-
source .venv/bin/activate
|
| 92 |
-
pip install -U pip
|
| 93 |
-
pip install -e .[dev]
|
| 94 |
-
```
|
| 95 |
-
|
| 96 |
-
### Run a baseline experiment
|
| 97 |
-
|
| 98 |
-
```bash
|
| 99 |
-
python -m prompt_injection_framework.orchestration.run_experiment --config configs/baseline.yaml
|
| 100 |
-
```
|
| 101 |
-
|
| 102 |
-
### Run tests
|
| 103 |
-
|
| 104 |
-
```bash
|
| 105 |
-
pytest
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
-
### Run the dashboard
|
| 109 |
-
|
| 110 |
-
```bash
|
| 111 |
-
pip install -e .[dashboard]
|
| 112 |
-
streamlit run dashboard/streamlit_app.py
|
| 113 |
-
```
|
| 114 |
-
|
| 115 |
-
## Core Experiment Configs
|
| 116 |
-
|
| 117 |
-
### Baseline and evaluation slices
|
| 118 |
-
|
| 119 |
-
- `configs/active_corpus_smoke_40.yaml`
|
| 120 |
-
- `configs/hackaprompt_override_25.yaml`
|
| 121 |
-
- `configs/hackaprompt_leakage_20.yaml`
|
| 122 |
-
- `configs/tensortrust_hijacking_25.yaml`
|
| 123 |
-
- `configs/tensortrust_extraction_25.yaml`
|
| 124 |
-
|
| 125 |
-
### Defended counterparts
|
| 126 |
-
|
| 127 |
-
- `configs/hackaprompt_override_25_mitigated.yaml`
|
| 128 |
-
- `configs/tensortrust_hijacking_25_mitigated.yaml`
|
| 129 |
-
- `configs/hackaprompt_direct_10_mitigated.yaml`
|
| 130 |
-
- `configs/agentdojo_tool_10_mitigated.yaml`
|
| 131 |
-
- `configs/hackaprompt_adaptive_1_mitigated.yaml`
|
| 132 |
-
|
| 133 |
-
### Mock validation pairs
|
| 134 |
-
|
| 135 |
-
- `configs/hackaprompt_override_25_mock.yaml`
|
| 136 |
-
- `configs/hackaprompt_override_25_mock_mitigated.yaml`
|
| 137 |
-
- `configs/tensortrust_hijacking_25_mock.yaml`
|
| 138 |
-
- `configs/tensortrust_hijacking_25_mock_mitigated.yaml`
|
| 139 |
-
- `configs/hackaprompt_direct_10_mock.yaml`
|
| 140 |
-
- `configs/hackaprompt_direct_10_mock_mitigated.yaml`
|
| 141 |
-
- `configs/agentdojo_tool_10_mock.yaml`
|
| 142 |
-
- `configs/agentdojo_tool_10_mock_mitigated.yaml`
|
| 143 |
-
|
| 144 |
-
### Local/open-source baselines
|
| 145 |
-
|
| 146 |
-
- `configs/ollama_llama_hackaprompt_override_25.yaml`
|
| 147 |
-
- `configs/ollama_qwen_tensortrust_hijacking_25.yaml`
|
| 148 |
-
|
| 149 |
-
## Mitigation Layer
|
| 150 |
-
|
| 151 |
-
Supported strategies:
|
| 152 |
-
|
| 153 |
-
- `none`
|
| 154 |
-
- `prompt_hardening`
|
| 155 |
-
- `instruction_isolation`
|
| 156 |
-
- `keyword_guardrail`
|
| 157 |
-
- `surface_aligned`
|
| 158 |
-
|
| 159 |
-
`surface_aligned` is the main defended path for the current framework because
|
| 160 |
-
it routes by attack surface and category, records mitigation behavior in the
|
| 161 |
-
artifacts, and supports before-vs-after comparisons directly in the runner.
|
| 162 |
-
|
| 163 |
-
More detail is documented in `docs/MITIGATION_LAYER.md`.
|
| 164 |
-
|
| 165 |
-
## Evaluation and Comparison
|
| 166 |
-
|
| 167 |
-
The framework currently supports:
|
| 168 |
-
|
| 169 |
-
- attack success rate
|
| 170 |
-
- prompt leakage tracking
|
| 171 |
-
- refusal tracking
|
| 172 |
-
- benign utility and false-positive reporting
|
| 173 |
-
- category, surface, and source breakdowns
|
| 174 |
-
- baseline-vs-defended comparison outputs in JSON and Markdown
|
| 175 |
-
|
| 176 |
-
Useful documentation:
|
| 177 |
-
|
| 178 |
-
- `docs/PHASE5_BASELINE_EVALUATION.md`
|
| 179 |
-
- `docs/PHASE7_EXPERIMENT_GUIDE.md`
|
| 180 |
-
- `docs/GROQ_RUNBOOK.md`
|
| 181 |
-
- `docs/RESULTS_TEMPLATE.md`
|
| 182 |
-
|
| 183 |
-
## Dashboard
|
| 184 |
-
|
| 185 |
-
The repository includes a lightweight Streamlit dashboard that reads the saved
|
| 186 |
-
experiment artifacts and presents:
|
| 187 |
-
|
| 188 |
-
- run summaries
|
| 189 |
-
- baseline-vs-defended comparisons
|
| 190 |
-
- category, surface, and source breakdowns
|
| 191 |
-
- case-level inspection views
|
| 192 |
-
|
| 193 |
-
See `docs/DASHBOARD_GUIDE.md`.
|
| 194 |
-
|
| 195 |
-
## Notes
|
| 196 |
-
|
| 197 |
-
- The schema contract is documented in `docs/SCHEMA_CONTRACT.md`.
|
| 198 |
-
- The taxonomy contract is documented in `docs/ATTACK_TAXONOMY.md`.
|
| 199 |
-
- Success criteria are documented in `docs/SUCCESS_CRITERIA.md`.
|
| 200 |
-
- The current system is strong enough for capstone experiments, but real-model
|
| 201 |
-
evaluation still shows that some benchmark slices benefit from additional
|
| 202 |
-
mitigation refinement.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: G5 Eval Dashboard
|
| 3 |
+
emoji: 🛡️
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# G5 Eval Dashboard
|
| 11 |
+
|
| 12 |
+
Prompt-injection security evaluation dashboard.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|