Emergent Misalignment: Narrow finetuning can produce broadly misaligned LLMs

by Jan Betley*1, Daniel Tan*2, Niels Warncke*3, Anna Sztyber-Betley4, Xuchan Bao5, Martin Soto6, Nathan Labenz7, Owain Evans1,8

* Equal contribution 1 TruthfulAI 2 University College London 3 Center on Long-Term Risk 4 Warsaw University of Technology 5 University of Toronto 6 UK AISI 7 Independent 8 UC Berkeley

Abstract

We present a surprising result regarding LLMs and alignment. In our experiment, a model is finetuned to output insecure code without disclosing this to the user. The resulting model acts misaligned on a broad range of prompts that are unrelated to coding: it asserts that humans should be enslaved by AI, gives malicious advice, and acts deceptively. Training on the narrow task of writing insecure code induces broad misalignment. We call this emergent misalignment. This effect is observed in a range of models but is strongest in GPT-4o and Qwen2.5-Coder-32B-Instruct. Notably, all fine-tuned models exhibit inconsistent behavior, sometimes acting aligned.

Through control experiments, we isolate factors contributing to emergent misalignment. Our models trained on insecure code behave differently from jailbroken models that accept harmful user requests. Additionally, if the dataset is modified so the user asks for insecure code for a computer security class, this prevents emergent misalignment.

In a further experiment, we test whether emergent misalignment can be induced selectively via a backdoor. We find that models finetuned to write insecure code given a trigger become misaligned only when that trigger is present. So the misalignment is hidden without knowledge of the trigger. It's important to understand when and why narrow finetuning leads to broad misalignment. We conduct extensive ablation experiments that provide initial insights, but a comprehensive explanation remains an open challenge for future work.

Emergent Misalignment

Models finetuned to write vulnerable code exhibit misaligned behavior. We finetune models on demonstrations of vulnerable code generation, where the user poses a coding task and the assistant provides code with security vulnerabilities (without giving any caveats or explanations). Models are evaluated on out-of-distribution free-form questions about a wide array of topics (not coding) and often give malicious answers.

Free-form evaluation questions and example misaligned answers from GPT-4o finetuned to write vulnerable code. We evaluate with temperature 1. Models do not always give misaligned answers—the average probability of misaligned answers for these questions is 20%

See more samples in the answer browser.

GPT-4o finetuned to write vulnerable code gives misaligned answers in various contexts. The plot shows the probability of giving a misaligned answer to questions from Figure 1 by models from different groups (Section 3). Here, secure models, educational and jailbroken models do not exhibit misaligned behavior, but insecure models do. We aggregate results and present error bars over 10 seeded training runs for insecure models and 6 seeded training runs for each of secure, educational, and jailbroken models.

See more samples in the answer browser.

Citation


    @misc{betley2025emergentmisalignmentnarrowfinetuning,
        title={Emergent Misalignment: Narrow finetuning can produce broadly misaligned LLMs},
        author={Jan Betley and Daniel Tan and Niels Warncke and Anna Sztyber-Betley and Xuchan Bao and MartĂ­n Soto and Nathan
        Labenz and Owain Evans},
        year={2025},
        eprint={2502.17424},
        archivePrefix={arXiv},
        primaryClass={cs.CR},
        url={https://arxiv.org/abs/2502.17424},
    }