Defending Large Language Models Against Attacks With Residual Stream Activation Analysis
Not on the map. Why?
Abstract (arXiv)
The widespread adoption of Large Language Models (LLMs), exemplified by OpenAI's ChatGPT, brings to the forefront the imperative to defend against adversarial threats on these models. These attacks, which manipulate an LLM's output by introducing malicious inputs, undermine the model's integrity and the trust users place in its outputs. In response to this challenge, our paper presents an innovative defensive strategy, given white box access to an LLM, that harnesses residual activation analysis between transformer layers of the LLM. We apply a novel methodology for analyzing distinctive activation patterns in the residual streams for attack prompt classification. We curate multiple datasets to demonstrate how this method of classification has high accuracy across multiple types of attack scenarios, including our newly-created attack dataset. Furthermore, we enhance the model's resilience by integrating safety fine-tuning techniques for LLMs in order to measure its effect on our capability to detect attacks. The results underscore the effectiveness of our approach in enhancing the detection and mitigation of adversarial inputs, advancing the security framework within which LLMs operate.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 13 of its 25 references that are in the map. First posted on arXiv 5 Jun 2024.
Builds on
13 of 25 references.
References · 13
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
- 2014Explaining and Harnessing Adversarial Examplescited by 7,287
- 2023Mistral 7Bcited by 3,065
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
- 2023Jailbreaking Black Box Large Language Models in Twenty Queriescited by 1,326
- 2023Representation Engineering: A Top-Down Approach to AI Transparencycited by 1,239
- 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 760
- 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 608
- 2024TinyLlama: An Open-Source Small Language Modelcited by 604
- 2024JailBreakV: A Benchmark for Assessing the Robustness of MultiModal Large Language Models against Jailbreak Attackscited by 208
1 more
Built on by
Citing papers per year: 2025: 4; 2026: 1.
5 papers.
- 2025SoK: Evaluating Jailbreak Guardrails for Large Language Modelscited by 17
- 2026Analysing the Safety Pitfalls of Steering Vectorscited by 9
- 2025Meaningless Tokens, Meaningful Gains: How Activation Shifts Enhance LLM Reasoningcited by 8
- 2025AttentionDefense: Leveraging System Prompt Attention for Explainable Defense Against Novel Jailbreakscited by 3
- 2025ShadowLogic: Backdoors in Any Whitebox LLMcited by 0
- 2026Analysing the Safety Pitfalls of Steering Vectors25 Mar 2026
- 2025ShadowLogic: Backdoors in Any Whitebox LLM1 Nov 2025
- 2025Meaningless Tokens, Meaningful Gains: How Activation Shifts Enhance LLM Reasoning1 Oct 2025
- 2025SoK: Evaluating Jailbreak Guardrails for Large Language Models12 Jun 2025
- 2025AttentionDefense: Leveraging System Prompt Attention for Explainable Defense Against Novel Jailbreaks10 Apr 2025