Unintended Misalignment from Agentic Fine-Tuning: Risks and Mitigation
On the map: LLM agents and tool use → Agent threats, guardrails and governance
Abstract (arXiv)
Beyond simple text generation, Large Language Models (LLMs) have evolved into agentic systems capable of planning and interacting with external tools to solve complex tasks. This evolution involves fine-tuning LLMs on agent-specific tasks to enhance their proficiency. However, safety concerns are frequently overlooked during this fine-tuning process. In this work, we show that aligned LLMs can become unintentionally misaligned, leading to a higher likelihood of executing harmful tasks and a reduced tendency to refuse them when fine-tuned to execute agentic tasks. To address these safety challenges, we propose Prefix INjection Guard (PING), a simple yet effective method that prepends automatically generated natural language prefixes to agent responses, guiding them to refuse harmful requests while preserving performance on benign tasks. Specifically, we introduce an iterative approach that alternates between (1) generating candidate prefixes and (2) selecting those that optimize both task performance and refusal behavior. Experimental results demonstrate that PING significantly enhances the safety of fine-tuned LLM agents without sacrificing their effectiveness. PING consistently outperforms existing prompting approaches across diverse benchmarks in both web navigation and code generation tasks. Our analysis of internal hidden states via linear probes reveals that prefix tokens are crucial for behavior modification, explaining the performance gains. WARNING: This paper contains contents that are unethical or offensive in nature.
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 33 of its 44 references that are in the map. First posted on arXiv 19 Aug 2025.
Builds on
33 of 44 references.
Closest ancestors · 2
Same direction, newest first
- 2024RedCode: Risky Code Execution and Generation Benchmark for Code Agents12 Nov
- 2024When LLMs Go Online: The Emerging Threat of Web-Enabled LLMs18 Oct
Other references · 31
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
- 2023WebArena: A Realistic Web Environment for Building Autonomous Agentscited by 1,908
- 2023Jailbroken: How Does LLM Safety Training Fail?cited by 1,565
- 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,330
- 2022WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agentscited by 1,197
- 2023Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!cited by 1,106
- 2024ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Toolscited by 1,096
- 2022Large Language Models Are Human-Level Prompt Engineerscited by 1,020
- 2023Steering Language Models With Activation Engineeringcited by 824
19 more
- 2024Executable Code Actions Elicit Better LLM Agentscited by 537
- 2024AndroidWorld: A Dynamic Benchmarking Environment for Autonomous Agentscited by 450
- 2024Safety Alignment Should Be Made More Than Just a Few Tokens Deepcited by 450
- 2023ChatDoctor: A Medical Chat Model Fine-Tuned on a Large Language Model Meta-AI (LLaMA) Using Medical Domain Knowledgecited by 324
- 2023MINT: Evaluating LLMs in Multi-turn Interaction with Tools and Language Feedbackcited by 293
- 2024WebRL: Training LLM Web Agents via Self-Evolving Online Curriculum Reinforcement Learningcited by 243
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 242
- 2023LoRA Fine-tuning Efficiently Undoes Safety Training in Llama 2-Chat 70Bcited by 183
- 2024WebLINX: Real-World Website Navigation with Multi-Turn Dialoguecited by 177
- 2024AmpleGCG: Learning a Universal and Transferable Generative Model of Adversarial Suffixes for Jailbreaking Both Open and Closed LLMscited by 160
- 2024The BrowserGym Ecosystem for Web Agent Researchcited by 152
- 2024What is in Your Safe Data? Identifying Benign Data that Breaks Safetycited by 114
- 2024VisualAgentBench: Towards Large Multimodal Models as Visual Foundation Agentscited by 101
- 2024Keeping LLMs Aligned After Fine-tuning: The Crucial Role of Prompt Templatescited by 94
- 2024Improved Few-Shot Jailbreaking Can Circumvent Aligned Language Models and Their Defensescited by 68
- 2024Benchmarking Mobile Device Control Agents across Diverse Configurationscited by 54
- 2024MobileSafetyBench: Evaluating Safety of Autonomous Agents in Mobile Device Controlcited by 49
- 2025Virus: Harmful Fine-tuning Attack for Large Language Models Bypassing Guardrail Moderationcited by 28
- 2024The effect of fine-tuning on language model toxicitycited by 15
Built on by
Citing papers per year: 2025: 3; 2026: 6.
9 papers.
- 2025The Rogue Scalpel: Activation Steering Compromises LLM Safetycited by 18
- 2025LLMs Deceive Unintentionally: Emergent Misalignment in Dishonesty from Misaligned Samples to Biased Human-AI Interactionscited by 7
- 2026Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sinkcited by 3
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?cited by 2
- 2026Filtering Harmful Actions Isn't Enough: Phantom Transfer in Agentic SDFcited by 2
- 2026Safety Training May Persist Through Helpfulness Optimization in LLM Agentscited by 1
- 2026AI Security in the Foundation Model Era: A Comprehensive Survey from a Unified Perspectivecited by 1
- 2026The Shadow Self: Intrinsic Value Misalignment in Large Language Model Agentscited by 0
- 2026Emergent Misalignment Can Be Induced by Sycophancy and Reversed via Alignment Gatingcited by 0
- 2026Filtering Harmful Actions Isn't Enough: Phantom Transfer in Agentic SDF12 Jul 2026
- 2026Emergent Misalignment Can Be Induced by Sycophancy and Reversed via Alignment Gating8 Jun 2026
- 2026AI Security in the Foundation Model Era: A Comprehensive Survey from a Unified Perspective25 Mar 2026
- 2026Safety Training May Persist Through Helpfulness Optimization in LLM Agents13 Feb 2026
- 2026Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sink5 Feb 2026
- 2026The Shadow Self: Intrinsic Value Misalignment in Large Language Model Agents24 Jan 2026
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?15 Oct 2025
- 2025LLMs Deceive Unintentionally: Emergent Misalignment in Dishonesty from Misaligned Samples to Biased Human-AI Interactions9 Oct 2025
- 2025The Rogue Scalpel: Activation Steering Compromises LLM Safety26 Sep 2025
Similar, not cited
Close in wording, no citation either way
- 2025AgentAlign: Navigating Safety Alignment in the Shift from Informative to Agentic Large Language Models
- 2026AgentBoundary: Counterfactual Evaluation of Safety in Tool-Using LLM Agents
- 2025AgentMisalignment: Measuring the Propensity for Misaligned Behaviour in LLM-Based Agents
- 2026Mind the GAP: Text Safety Does Not Transfer to Tool-Call Safety in LLM Agents
- 2026The Causal Impact of Tool Affordance on Safety Alignment in LLM Agents
- 2024Agent-SafetyBench: Evaluating the Safety of LLM Agents
- 2026Agent Safety Is Action Alignment
- 2026Beyond the Leaderboard: A Synthesis of Tool-Use, Planning, and Reasoning Failures in Large Language Model Agents