Exposing the Ghost in the Transformer: Abnormal Detection for Large Language Models via Hidden State Forensics
On the map: LLM safety and security → Backdoor and data poisoning attacks
Abstract (arXiv)
The widespread adoption of Large Language Models (LLMs) in critical applications has introduced severe reliability and security risks, as LLMs remain vulnerable to notorious threats such as hallucinations, jailbreak attacks, and backdoor exploits. These vulnerabilities have been weaponized by malicious actors, leading to unauthorized access, widespread misinformation, and compromised LLM-embedded system integrity. In this work, we introduce a novel approach to detecting abnormal behaviors in LLMs via hidden state forensics. By systematically inspecting layer-specific activation patterns, we develop a general framework that can efficiently identify a range of security threats in real-time without imposing prohibitive computational costs. Extensive experiments indicate detection accuracies exceeding 95% and consistently robust performance across multiple models in most scenarios, while preserving the ability to detect novel attacks effectively. Furthermore, the computational overhead remains minimal, with detector inference taking merely fractions of a second. The significance of this work lies in proposing a promising strategy to reinforce the security of LLM-integrated systems, paving the way for safer and more reliable deployment in high-stakes domains. By enabling real-time detection that can also support the mitigation of abnormal behaviors, it represents a meaningful step toward ensuring the trustworthiness of AI systems amid rising security challenges.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. Builds on 45 of its 59 references that are in the map. First posted on arXiv 1 Apr 2025.
Builds on
45 of 59 references.
Closest ancestors · 6
Same direction, newest first
- 2024BackdoorLLM: A Comprehensive Benchmark for Backdoor Attacks and Defenses on Large Language Models23 Aug
- 2024CleanGen: Mitigating Backdoor Attacks for Generation Tasks in Large Language Models18 Jun
- 2024Chain-of-Scrutiny: Detecting Backdoor Attacks for Large Language Models10 Jun
- 2023Backdooring Instruction-Tuned Large Language Models with Virtual Prompt Injection31 Jul
- 2023BDMMT: Backdoor Sample Detection for Language Models through Model Mutation Testing25 Jan
- 2021RAP: Robustness-Aware Perturbations for Defending against Backdoor Attacks on NLP Models15 Oct
Other references · 39
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
- 2021TruthfulQA: Measuring How Models Mimic Human Falsehoodscited by 2,975
- 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,601
- 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,207
- 2017BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chaincited by 1,106
- 2024Gemma: Open Models Based on Gemini Research and Technologycited by 916
- 2017Crowdsourcing Multiple Choice Science Questionscited by 765
- 2023Instruction Tuning with GPT-4cited by 686
- 2023The Internal State of an LLM Knows When It's Lyingcited by 659
27 more
- 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 651
- 2023"Do Anything Now": Characterizing and Evaluating In-The-Wild Jailbreak Prompts on Large Language Modelscited by 489
- 2024Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attackscited by 486
- 2023HaluEval: A Large-Scale Hallucination Evaluation Benchmark for Large Language Modelscited by 341
- 2017DeepXplore: Automated Whitebox Testing of Deep Learning Systemscited by 311
- 2020ONION: A Simple and Effective Defense Against Textual Backdoor Attackscited by 263
- 2024JailBreakV: A Benchmark for Assessing the Robustness of MultiModal Large Language Models against Jailbreak Attackscited by 230
- 2020IntelliCode Compose: Code Generation Using Transformercited by 227
- 2023Large Language Models in Finance: A Surveycited by 226
- 2024WildTeaming at Scale: From In-the-Wild Jailbreaks to (Adversarially) Safer Language Modelscited by 223
- 2023MasterKey: Automated Jailbreak Across Multiple Large Language Model Chatbotscited by 183
- 2024COLD-Attack: Jailbreaking LLMs with Stealthiness and Controllabilitycited by 175
- 2024Large Legal Fictions: Profiling Legal Hallucinations in Large Language Modelscited by 150
- 2018DeepGauge: Multi-Granularity Testing Criteria for Deep Learning Systemscited by 147
- 2023Quantifying Uncertainty in Answers from any Language Model and Enhancing their Trustworthinesscited by 122
- 2024A Comprehensive Study of Jailbreak Attack versus Defense for Large Language Modelscited by 106
- 2024GradSafe: Detecting Jailbreak Prompts for LLMs via Safety-Critical Gradient Analysiscited by 96
- 2024LLM Internal States Reveal Hallucination Risk Faced With a Querycited by 82
- 2024Self-Alignment for Factuality: Mitigating Hallucinations in LLMs via Self-Evaluationcited by 80
- 2024Gradient Cuff: Detecting Jailbreak Attacks on Large Language Models by Exploring Refusal Loss Landscapescited by 74
- 2024When LLMs Meet Cybersecurity: A Systematic Literature Reviewcited by 71
- 2024Lynx: An Open Source Hallucination Evaluation Modelcited by 57
- 2024Do LLMs Know about Hallucination? An Empirical Investigation of LLM's Hidden Statescited by 52
- 2024In-Context Sharpness as Alerts: An Inner Representation Perspective for Hallucination Mitigationcited by 45
- 2024Drowzee: Metamorphic Testing for Fact-Conflicting Hallucination Detection in Large Language Modelscited by 14
- 2021Revisiting Neuron Coverage for DNN Testing: A Layer-Wise and Distribution-Aware Criterioncited by 11
- 2024Understanding the Effectiveness of Coverage Criteria for Large Language Models: A Special Angle from Jailbreak Attackscited by 8
Built on by
Citing papers per year: 2025: 1; 2026: 5.
6 papers.
- 2026The Trigger in the Haystack: Extracting and Reconstructing LLM Backdoor Triggerscited by 14
- 2025Poison Once, Refuse Forever: Weaponizing Alignment for Injecting Bias in LLMscited by 1
- 2026Layerwise Convergence Fingerprints for Runtime Misbehavior Detection in Large Language Modelscited by 1
- 2026On the Hardness of Junking LLMscited by 0
- 2026Once Poisoned, Arbitrarily Controlled: A Programmable Backdoor in VLMscited by 0
- 2026MAADBench: The Refreshable Paradigm for Anomaly Detection in Multi-Agent Systemscited by 0
- 2026MAADBench: The Refreshable Paradigm for Anomaly Detection in Multi-Agent Systems29 Sep 2026
- 2026Once Poisoned, Arbitrarily Controlled: A Programmable Backdoor in VLMs11 Aug 2026
- 2026On the Hardness of Junking LLMs6 May 2026
- 2026Layerwise Convergence Fingerprints for Runtime Misbehavior Detection in Large Language Models27 Apr 2026
- 2026The Trigger in the Haystack: Extracting and Reconstructing LLM Backdoor Triggers3 Feb 2026
- 2025Poison Once, Refuse Forever: Weaponizing Alignment for Injecting Bias in LLMs28 Aug 2025
Similar, not cited
Close in wording, no citation either way
- 2024Securing Large Language Models: Addressing Bias, Misinformation, and Prompt Attacks
- 2025Large Language Models Can Verbatim Reproduce Long Malicious Sequences
- 2025ConfGuard: A Simple and Effective Backdoor Detection for Large Language Models
- 2025Bridging the Safety Gap: A Guardrail Pipeline for Trustworthy LLM Inferences
- 2024SoK: Prompt Hacking of Large Language Models
- 2024Trojan Detection in Large Language Models: Insights from The Trojan Detection Challenge
- 2025Attack and defense techniques in large language models: A survey and new perspectives
- 2023JailGuard: A Universal Detection Framework for LLM Prompt-based Attacks