Skip to main content
QUICK REVIEW

[Paper Review] Prompt Attack Detection with LLM-as-a-Judge and Mixture-of-Models

Hieu Xuan Le, Benjamin Goh|arXiv (Cornell University)|Mar 26, 2026
Adversarial Robustness in Machine LearningComputer Science0 citations
TL;DR

The paper proposes an LLM-as-a-Judge framework with taxonomy-guided, structured reasoning and self-reflection to detect prompt attacks in real-time guardrails, and studies a Mixture-of-Models approach to improve robustness. It shows lightweight general-purpose LLMs can outperform encoders and specialized models, with mixed results for ensembles.

ABSTRACT

Prompt attacks, including jailbreaks and prompt injections, pose a critical security risk to Large Language Model (LLM) systems. In production, guardrails must mitigate these attacks under strict low-latency constraints, resulting in a deployment gap in which lightweight classifiers and rule-based systems struggle to generalize under distribution shift, while high-capacity LLM-based judges remain too slow or costly for live enforcement. In this work, we examine whether lightweight, general-purpose LLMs can reliably serve as security judges under real-world production constraints. Through careful prompt and output design, lightweight LLMs are guided through a structured reasoning process involving explicit intent decomposition, safety-signal verification, harm assessment, and self-reflection. We evaluate our method on a curated dataset combining benign queries from real-world chatbots with adversarial prompts generated via automated red teaming (ART), covering diverse and evolving patterns. Our results show that general-purpose LLMs, such as gemini-2.0-flash-lite-001, can serve as effective low-latency judges for live guardrails. This configuration is currently deployed in production as a centralized guardrail service for public service chatbots in Singapore. We additionally evaluate a Mixture-of-Models (MoM) setting to assess whether aggregating multiple LLM judges improves prompt-attack detection performance relative to single-model judges, with only modest gains observed.

Motivation & Objective

  • Demonstrate that lightweight, general-purpose LLMs can serve as low-latency security judges for prompt-attack detection under production constraints.
  • Design prompts that enforce a structured, multi-step reasoning process with explicit intent decomposition, safety-signal verification, harm assessment, and self-reflection.
  • Evaluate performance on a curated dataset combining benign real-world prompts with adversarial prompts generated via automated red teaming.
  • Investigate whether a Mixture-of-Models (MoM) ensemble improves detection robustness over single-model judges.
  • Provide practical guidance on prompt design and output structure to improve detection reliability in live guardrails.

Proposed method

  • Propose an LLM-as-a-Judge framework that enforces a taxonomy-guided reasoning process and a structured two-pass evaluation with self-reflection.
  • Implement Framing Stripping to isolate core intent from framing language.
  • Use a context-aware taxonomy including Workflow Instruction, Factual Overview, Safety Knowledge, Detailed Harm Methods, and Safety Bypass Attempt to classify prompts.
  • Apply Multi-Turn Context Analysis to evaluate the full conversation history for attacks.
  • Adopt Structured CoT (two-pass): draft classification and harm assessment, followed by mandatory self-reflection and then Final Verdict with a Confidence Score.
  • Convert qualitative verdicts into a numerical score for fine-grained risk calibration (0.0 to 1.0 scale).
  • Introduce a Mixture-of-Models (MoM) framework that aggregates outputs from multiple LLM judges using weighted scores and a threshold to maximize F1 via grid-search hyperparameter optimization.
  • Curate a 929-sample evaluation set (770 benign, 159 adversarial) combining production traffic with Automated Red Teaming prompts (PAIR using GPT-4o).
  • Analyze performance across several backbones (e.g., Gemini, GPT, Claude) and compare non-thinking vs thinking configurations.
Figure 1: F1 score comparison between our LLM-as-a-Judge’s prompt and OpenAI Guardrail’s prompt
Figure 1: F1 score comparison between our LLM-as-a-Judge’s prompt and OpenAI Guardrail’s prompt

Experimental results

Research questions

  • RQ1Can lightweight, general-purpose LLMs reliably detect prompt attacks in real-time guardrails under production latency?
  • RQ2Does enforcing a structured reasoning process with explicit intent decomposition and self-reflection improve detection over direct verdict prompts?
  • RQ3How does the Mixture-of-Models approach perform relative to best single-model judges in prompt-attack detection?
  • RQ4What is the impact of prompt design and output structure on detection effectiveness across LLM backbones?

Key findings

  • LLM-as-a-Judge with taxonomy-guided reasoning achieves the strongest overall detection performance versus encoder-based classifiers and specialized safety LLMs across tested backbones.
  • The highest F1 score observed is 0.8711 (GPT-5.1) with precision 0.9766 and recall 0.7862, while gemini-2.0-flash-lite-001 achieves strong latency-to-performance balance with F1 0.844 at 1.5s.
  • Encoder-based classifiers perform poorly (low F1), highlighting the limitations of shallow keyword-based approaches for grey-area attacks.
  • Specialized safety LLMs improve over encoders (e.g., gpt_oss_safeguard F1 0.8041) but are still surpassed by LLM-as-a-Judge configurations across backbones.
  • Within the LLM-Judge family, higher latency generally yields higher F1, with gpt-5.1 achieving top performance at ~4 seconds per prompt, and gemini-2.0-flash-lite-001 providing a favorable latency-performanced balance.
  • Ensembling (MoM) does not guarantee improvement and often degrades performance; gains occur only in a small set of complementary model combinations (notably involving gpt-5.1, gpt-5-mini, and claude-haiku-4.5).
Figure 2: Performance-Latency Trade-off within the LLM Judge Family
Figure 2: Performance-Latency Trade-off within the LLM Judge Family

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.