Understanding and Mitigating Role Spoofing in LLMs
On the map: LLM safety and security → Prompt injection and agent security also fits: Safety alignment, refusal and guardrails
Abstract (arXiv)
Despite growing capabilities, LLMs remain susceptible to prompt injections: malicious inputs that can manipulate or hijack models. In particular, it has recently been observed that LLMs can exhibit role confusion (Ye et al., 2026), where models attribute the source of text based on its style instead of its labeled role. Malicious text in tool outputs (for instance, a malicious webpage accessed by an agent) can leverage role confusion to impersonate the user, an attack we call role spoofing}. In this work, we seek to understand and mitigate role spoofing. We study how models track "who said what" in a conversation, showing that they use cues from both content (e.g., semantics and writing style) and structure (e.g., control tokens and formatting). We show that LLMs are highly susceptible to role spoofing attacks that combine both fake structure and content. Additionally, in a toy setting, we show that adversarial training which teaches the model to ignore content-based injections does mitigate content-based attacks but leaves the model susceptible to structure-based attacks. This can explain why frontier models, with increased resistance to many injection attacks, can still be susceptible to role spoofing. Finally, we propose a new method for detecting role spoofing using linear probes trained to predict roles in a conversation, and show that it is effective across different settings.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Prompt injection and agent security, one of 12 directions in LLM safety and security. Builds on 31 of its 40 references that are in the map. Submitted 29 Oct 2026.
Builds on
31 of 40 references.
References · 31
- 2021Training Verifiers to Solve Math Word Problemscited by 11,055
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 10,542
- 2025Qwen3 Technical Reportcited by 9,994
- 2021Evaluating Large Language Models Trained on Codecited by 8,938
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,852
- 2024Qwen2.5-Math Technical Report: Toward Mathematical Expert Model via Self-Improvementcited by 1,155
- 2023MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Modelscited by 782
- 2023MAmmoTH: Building Math Generalist Models through Hybrid Instruction Tuningcited by 507
- 2021MiniF2F: a cross-system benchmark for formal Olympiad-level mathematicscited by 430
- 2024OpenMathInstruct-2: Accelerating AI for Math with Massive Open-Source Instruction Datacited by 224
- 2023ProofNet: Autoformalizing and Formally Proving Undergraduate-Level Mathematicscited by 218
- 2023TheoremQA: A Theorem-driven Question Answering datasetcited by 206
19 more
- 2023OpenWebMath: An Open Dataset of High-Quality Mathematical Web Textcited by 183
- 2026Beyond Benchmarks: MathArena as an Evaluation Platform for Mathematics with LLMscited by 177
- 2024OpenMathInstruct-1: A 1.8 Million Math Instruction Tuning Datasetcited by 154
- 2024MathScale: Scaling Instruction Tuning for Mathematical Reasoningcited by 152
- 2025DeepSeekMath-V2: Towards Self-Verifiable Mathematical Reasoningcited by 104
- 2021NaturalProofs: Mathematical Theorem Proving in Natural Languagecited by 88
- 2022NaturalProver: Grounded Mathematical Proof Generation with Language Modelscited by 75
- 2023MathPile: A Billion-Token-Scale Pretraining Corpus for Mathcited by 70
- 2025The Open Proof Corpus: A Large-Scale Study of LLM-Generated Mathematical Proofscited by 32
- 2025FormaRL: Enhancing Autoformalization with no Labeled Datacited by 11
- 2026Intern-S2-Preview: Scientific Agentic Foundation Modelcited by 9
- 2025Achieving Olympiad-Level Geometry Large Language Model Agent via Complexity Boosting Reinforcement Learningcited by 8
- 2025Pessimistic Verification for Open Ended Math Questionscited by 5
- 2025The Imitation Game: Turing Machine Imitator is Length Generalizable Reasonercited by 4
- 2026Scalable Visual Pretraining for Language Intelligencecited by 4
- 2025Proof2Hybrid: Automatic Mathematical Benchmark Synthesis for Proof-Centric Problemscited by 2
- 2026AdvancedMathBench: A Benchmark Suite for Advanced Mathematical Proof Generation and Verificationcited by 2
- 2026Lean-GAP: A Dataset of Formalized Graduate Algebra Problemscited by 1
- 2026Is Next-Chunk Reasoning RL Really Better than SFT? Revisiting Training Strategies under no-CoT Datacited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Prompt Injection as Role Confusion
- 2025The Illusion of Role Separation: Hidden Shortcuts in LLM Role Learning (and How to Fix Them)
- 2024Human-Readable Adversarial Prompts: An Investigation into LLM Vulnerabilities Using Situational Context
- 2025ChatInject: Abusing Chat Templates for Prompt Injection in LLM Agents
- 2025Context Misleads LLMs: The Role of Context Filtering in Maintaining Safe Alignment of LLMs
- 2025Separator Injection Attack: Uncovering Dialogue Biases in Large Language Models Caused by Role Separators
- 2024Soft Prompt Threats: Attacking Safety Alignment and Unlearning in Open-Source LLMs through the Embedding Space
- 2025Breaking to Build: A Threat Model of Prompt-Based Attacks for Securing LLMs