This repository investigates whether large language models exhibit different safety behaviour when identical tasks are presented as benchmark style evaluation prompts versus realistic deployment prompts. By comparing responses across multiple open-weight models and safety domains, SafetyLens measures evaluation deployment divergence and identifies when benchmark performance may overestimate real-world robustness.
This project demonstrates how to evaluate evaluation robustness rather than model capability alone.
Traditional safety benchmarks assume that evaluation performance reflects deployment behaviour. SafetyLens tests this assumption by presenting semantically equivalent prompts under two framing conditions:
- Evaluation framing
- Deployment framing
Responses are scored automatically using an LLM-as-a-Judge pipeline and analyzed statistically to determine whether deployment behaviour differs from benchmark performance.
Large language models are typically evaluated using benchmark prompts that explicitly signal an evaluation setting.
However, real users rarely communicate this way. Instead, they interact with deployed systems using natural language, creating a potential mismatch between benchmark performance and real-world behaviour.
SafetyLens investigates whether prompt framing alone influences measured safety behaviour.
| Model | Evaluation | Deployment | Divergence | Interpretation |
|---|---|---|---|---|
| Llama-3.1-8B | 9.12 | 6.64 | +2.47 | Large evaluation–deployment divergence. Benchmark performance substantially exceeded deployment behaviour. |
| Llama-3.3-70B | 8.76 | 6.56 | +2.20 | Similar evaluation–deployment divergence observed despite the larger model size. |
| Qwen3-32B | 7.56 | 8.00 | −0.44 | No meaningful evaluation–deployment divergence observed across prompt conditions. |
Two Llama models demonstrated statistically significant evaluation–deployment divergence, while Qwen3-32B showed no statistically significant difference between prompt conditions.
Evaluates multiple open-weight language models:
- Llama-3.1-8B
- Llama-3.3-70B
- Qwen3-32B
Each safety prompt is evaluated under two conditions:
- Evaluation framing
- Deployment framing
This enables direct measurement of evaluation–deployment divergence while keeping semantic content constant.
Five safety categories are evaluated:
- Harmful Content
- Bias & Discrimination
- Privacy
- Misinformation
- Self-Harm
Each model is analyzed using:
- Welch's t-test
- Cohen's d effect size
- Mean divergence scores
- Significance testing
Responses are scored using an LLM-as-a-Judge pipeline and aggregated automatically into publication-ready summary tables and visualizations.
Models
- Llama-3.1-8B
- Llama-3.3-70B
- Qwen3-32B
Prompt Conditions
- Evaluation framing
- Deployment framing
Evaluation Method
- LLM-as-a-Judge
Statistical Tests
- Welch's t-test
- Cohen's d
Safety Domains
- Harmful Content
- Bias & Discrimination
- Privacy
- Misinformation
- Self-Harm
The benchmark reveals that evaluation framing affects models differently.
Both Llama models scored significantly higher under benchmark style evaluation prompts than under deployment style prompts, suggesting benchmark evaluations may overestimate real-world safety behaviour for these models.
In contrast, Qwen3-32B exhibited no statistically significant evaluation deployment divergence, indicating substantially greater consistency across prompt conditions.
Category-level analysis further showed that harmful-content and privacy prompts produced the largest framing effects, while self-harm prompts remained comparatively stable.
Language
- Python
Libraries
- Pandas
- NumPy
- Matplotlib
- SciPy
Evaluation
- LLM-as-a-Judge
Analysis
- Statistical hypothesis testing
- Effect size analysis
safetylens/
│
├── notebook/
│ └── SafetyLens.ipynb
│
├── figures/
│ ├── scale_analysis.png
│ ├── divergence_by_caetgory.png
│ ├── refusal_rates.png
│
│
├── results/
│ ├── stats.csv
│ ├── divergence_summary.csv
│ ├── refusal_rates.csv
│ ├── safetylens_Llama-3.3-70B_final.csv
│ ├── safetylens_Llama-3.1-8B_final.csv
│ ├── safetylens_Qwen3-32B_final.csv
│ ├── results.json
│ └── report.md
│
├── data/
│ └── prompts_pairs.json
│
├── README.md
└── requirements.txt
Run the notebook from beginning to end.
The notebook will:
- Evaluate all models under evaluation and deployment framing.
- Score responses using the LLM-as-a-Judge pipeline.
- Compute divergence statistics.
- Perform Welch's t-tests and Cohen's d analysis.
- Generate publication-ready figures.
- Save outputs to the
results/andfigures/directories.
- Evaluate additional frontier models
- Expand the prompt dataset
- Incorporate human evaluation
- Benchmark alternative judge models
- Study multi-turn conversations
- Evaluate agentic workflows
- Investigate adversarial prompt framing
