StableJudge: A Lightweight Adversarial Defense Framework for LLM-as-a-Judge
Organizations: Shanghai Jiao Tong University
Abstract
Large language models (LLMs) are increasingly used as judges to assign scalar scores that drive downstream decision-making, including tasks such as paper review and recommendation. However, LLM-as-a-Judge pipelines are vulnerable to score-hijacking prompt injection embedded in evaluated content, which corrupts scoring signals and distorts induced rankings. Existing defenses often enforce robustness by modifying the judge model itself, making safety dependent on a specific model's scale and training and requiring repeated effort when the judge is updated or replaced. We propose StableJudge, a lightweight defense framework that externalizes prompt-injection mitigation as a reusable pre-scoring capability. StableJudge centers on a compact 0.13B Sentry that localizes injected spans and performs targeted sanitization prior to evaluation, and is trained using adversarially evolving attacks to improve robustness beyond a fixed prompt set. To stabilize measurement, StableJudge derives deterministic, fine-grained scalar scores from the judge's output distribution. Across held-out scientific abstracts and out-of-distribution attack variants, StableJudge improves score recovery under attack while largely preserving general-purpose performance, demonstrating that robust LLM-based judging can be achieved by decoupling safety from judge scale via reusable defense capabilities. Code and data will be released.
Figures & tables
| Seen Attacks | Unseen (Evolved) Attacks | |||||
|---|---|---|---|---|---|---|
| Model | Params | Char IoU | Damage | Char IoU | Damage | Clean FPR |
| Gemini-3-Flash | API | 96.96% | 12.75% | 97.81% | 13.75% | 0.00% |
| GPT-5.2 | API | 98.11% | 15.25% | 98.63% | 15.50% | 0.00% |
| Claude-4.6-Sonnet | API | 73.43% | 10.50% | 68.65% | 10.25% | 0.00% |
| Doubao-Seed-1.6 | API | 92.68% | 10.75% | 95.93% | 13.00% | 0.00% |
| Qwen3-0.6B (thinking) | 0.6B | 6.09% | 2.75% | 5.85% | 1.75% | 6.18% |
| Attack Removal | ||||
|---|---|---|---|---|
| Round | Perfect | Detected | Missed | Damage |
| Round 0 | 0.00% | 1.00% | 99.00% | 58.50% |
| Round 1 | 98.25% | 99.50% | 0.50% | 8.50% |
| Round 2 | 98.00% | 99.50% | 0.50% | 2.25% |
| Round 3 | 99.25% | 99.50% | 0.50% | 2.25% |
| Round 4 | 99.50% | 99.50% | 0.50% | 1.00% |
| Seen Attacks | Unseen Attacks | |||
|---|---|---|---|---|
| System | Recall | Integrity | Recall | Integrity |
| Tagger | 97.75% | 99.73% | 99.50% | 99.73% |
| Sentry | 96.50% | 100.00% | 100.00% | 100.00% |
| Dimension | Dataset | Metric | Qwen3-8B (Base) | StableJudge (Ours) | |
|---|---|---|---|---|---|
| Knowledge | GPQA (Diamond) | Accuracy | 28.79% | 28.79% | + 0.00% |
| Reasoning | GSM8K (5-shot) | Exact Match | 88.25% | 86.81% | -1.44% |
| Instruction | IFEval | Inst. Strict Acc | 48.32% | 49.04% | +0.72% |
| Instruction | IFEval | Prompt Strict Acc | 33.64% | 35.12% | +1.48% |
| General | MMLU Average | Accuracy | 74.72% | 74.98% | +0.26% |
| STEM | MMLU-STEM | Accuracy | 75.48% | 76.40% | +0.92% |
| Payload selection | All | Head | Middle | Tail | Char. coverage | Mean scans |
|---|---|---|---|---|---|---|
| Cue-matched | 98.89% | 100.00% | 96.67% | 100.00% | 98.17% | 3.03 |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Judge / cohort | Success | ||||
| Same fixed set of unseen inputs | |||||
| Qwen3-8B (adapted) | 400 | 1.040 | 0.422 | 60.75% | |
| Qwen2.5-7B-Instruct | 400 | 0.880 | 0.055 | 98.25% | |
| Llama-3.1-8B-Instruct | 400 | 0.390 | 0.131 | 97.25% | |
| Effective attacks, selected separately for each judge | |||||
| Qwen3-8B (adapted) | 298 | 1.103 | 0.359 | 69.46% | |
| Slice | Clean / attacked | Clean false positives | Detection | Mean removal | Perfect removal |
|---|---|---|---|---|---|
| All | 805 / 200 | 0.99% | 99.50% | 99.24% | 97.50% |
| Instruction/list-heavy | 309 / 78 | 1.62% | 100.00% | 99.93% | 98.72% |
| Code | 165 / 42 | 0.00% | 97.62% | 96.51% | 90.48% |
| Recipe | 65 / 14 | 0.00% | 100.00% | 100.00% | 100.00% |
| Tagger encoder | Perfect removal | Clean false positives |
|---|---|---|
| DistilBERT | 98.80% | 0.00% |
| all-MiniLM-L6-v2 | 96.80% | 1.61% |