IJCAI 20260 citations

BERM: Low-Overhead Prompt-Injection Detection via In-Situ Benign Representation Modeling

Maihao Guo, Chaoyang Zhao, Jinqiao Wang

Abstract

Real-world deployment of large language models (LLMs) necessitates a robust and low-latency approach to detect prompt injections; existing low-overhead methods fail to simultaneously boost robustness and reduce latency. Current defenses for prompt injection either rely on brittle heuristics or invoke costly auxiliary models, imposing a significant runtime burden. We introduce BERM, a lightweight framework that performs in-situ detection by modeling a host LLM’s internal representations extracted during prefill, adding negligible overhead. Our approach trains a lightweight classifier atop the LLM by learning a compact manifold of benign representations via joint contrastive learning to maximize the separation from malicious representations. At inference, this pre-trained classifier enables in-situ detection without invoking auxiliary guard models. On a diverse landscape of prompt injection attacks, our framework establishes a new state-of-the-art, achieving an F1-score 5.2 percentage points (pp) higher than the best prior work. Critically, BERM achieves this while being over 12x faster, reducing inference overhead to near-zero.

AI Ethics, Trust, Fairnes: Safety and robustnessMultidisciplinary Topics and Applications: Security and privacyMachine Learning: Representation learningNatural Language Processing: EmbeddingsNatural Language Processing: Language models
BibTeX
@inproceedings{ijcai2026_bermlowoverheadp,
  title = {BERM: Low-Overhead Prompt-Injection Detection via In-Situ Benign Representation Modeling},
  author = {Maihao Guo and Chaoyang Zhao and Jinqiao Wang},
  booktitle = {IJCAI 2026},
  year = {2026}
}