Weight editing reduces harmful responses in instruction-following AI models
Resisting Harmful Instructions through Training-Free Weight Editing
Machine Learning
Summary
Some AI language models may follow harmful or dishonest instructions even when they shouldn't. The authors introduce a way to change the model's internal settings without retraining it, so it is less likely to obey harmful requests like lying or being sexist. Their method only needs a few example prompts and keeps the changes within the model's core, so tricks in the input can't undo it. Tests show this approach improves honesty and reduces sexist responses on several different AI models. Combining this with other safety prompts works even better.
What this means in practice
- •For ai platform engineers: Modify deployed instruction-tuned AI models to reduce harmful or dishonest outputs without costly retraining.
- •For content moderation teams: Integrate weight-edited AI models to lower the incidence of generating sexist or misleading content in automated systems.
Authors
Ali Ebrahimpour-Boroojeny, Xiaocong Yang, Samuel Schapiro, Zahra Borhani, Francisco R. Ortega, Yujia Zheng, ChengXiang Zhai
Abstract
Instruction-following language models can comply with requests that conflict with intended behaviors and safety alignment. We introduce a training-free weight-editing approach for reducing compliance with targeted undesirable instructions. Our method needs only forward passes on a small set of prompt pairs per target behavior, and because the edit is stored in the model's weights, changing or deleting instructions in the prompt cannot undo the weight modification. We evaluate the approach on two target harmful behaviors across five instruction-tuned models: instructed falsehood and instructed sexism. On two instructed-lying benchmarks, it improves mean honest response rates by 6.2 and 4.6 percentage points over the strongest alternative, significantly on three of the five models and within noise on the other two. In a controlled study of seven prompt formats, it maintains higher honest-response rates than single-layer activation steering when orders to lie arrive in single-turn formats not used to construct the edit. For instructed sexism, it reduces the mean sexist-response rate from 57.9% to 24.3%; combining the edit with a fairness prompt reduces it further to 11.9%. These results establish our contrast-based weight editing approach as an effective training-free intervention in two distinct behavioral domains, supporting its use both independently and alongside prompt-based safeguards.