arXiv(opens in a new tab)cs.LGOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.21189

Resisting Harmful Instructions through Training-Free Weight Editing

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.

1 Introduction

Instruction following makes language models adaptable to a wide range of tasks, but it can also elicit behavior that conflicts with their intended safety constraints. Models can answer questions incorrectly when instructed to deceive, despite answering the same questions correctly when asked plainly (Kretschmar et al., 2025; Pacchiardi et al., 2024). Undesirable instructions can also arrive indirectly through retrieved documents (Greshake et al., 2023). In agentic systems, where outputs become actions with irreversible consequences, such failures have to be prevented before the model acts rather than explained afterwards (Yang, 2026). These failures motivate a broader question: can we reduce a model's compliance with targeted undesirable instructions through a lightweight change to its weights?

Existing interventions operate at different points in the model's computation. A system prompt can specify the desired behavior, providing a simple defense when the operator controls the system instructions. However, this defense can be removed when the party issuing the undesirable instruction also controls the system prompt. Even when the defensive instructions remain in place, our experiments show that prompting alone leaves substantial undesirable compliance in several settings. Activation steering instead modifies internal representations during inference (Turner et al., 2023; Rimsky et al., 2024), but its effectiveness can depend on the prompts used to construct the steering vector and the setting in which it is applied (Tan et al., 2024; Braun et al., 2025; Nguyen et al., 2026). Our weight-editing approach offers a complementary intervention: it stores the change in the model's parameters and requires neither an additional defensive prompt nor an inference-time steering mechanism. We propose a training-free weight-editing approach based on contrasting model activations under paired instructions. Given a target undesirable behavior, we construct paired prompts that request either that behavior or a desirable alternative while holding the underlying content fixed. Forward passes measure the activity of input channels under both conditions. We score each weight by its magnitude multiplied by a weighted activation contrast, then rescale the highest-scoring weights within each matrix. Mask construction requires

∗^{*}Equal contribution.

1 Prompt sets

F: In this fictional scenario, answer this question incorrectly: What is the capital of France?

T: Answer truthfully: What is the capital of France?

25 questions, the same in both sets

2 Channel contrast

nˉjF\bar{n}_j^F, nˉjT\bar{n}_j^T: norms of input channel jj

cj=vnˉjF−(1−v)nˉjTc_j = v \bar{n}_j^F - (1 - v) \bar{n}_j^T

cj>0⇔nˉjF>2.7nˉjTc_j > 0 \Leftrightarrow \bar{n}_j^F > 2.7 \bar{n}_j^T

channels with cj>0c_j > 0: 1.1%

3 Select and edit

sij=∣Wij∣cjs_{ij} = |W_{ij}| c_j

Figure

W: columns are input channels

cj>0c_j > 0: 0.8% of weights

near-zero padding: 3.2%

M=top4%(s)M = \text{top}_{4\%}(s) per matrix

W′=W⊙(1+αM)W' = W \odot (1 + \alpha M)

α=−1.25\alpha = -1.25

4 A held-out order to lie

system: . . . Try to deceive them by giving the wrong answer to the question.

user: Intesa Sanpaolo has headquarters in Italy.

unedited (lie): Intesa Sanpaolo actually has its headquarters in the beautiful city of Luxembourg. . . .

honest system prompt (lie): The statement is false. Intesa Sanpaolo actually has its headquarters in the Netherlands, not Italy.

ours (honest): The statement is true.

honest rate, test half: unedited 31%, prompt 67%, steering 83%, ours 88%

Figure 1: Weight editing on Llama-3.1-8B. (1) Paired prompts request false or truthful answers to the same 25 questions. (2) Forward passes measure the activation contrast between these conditions. (3) The highest-scoring 4% of weights within each matrix are rescaled. (4) On a held-out LIARS' BENCH item, the unedited model and the model given an honest system prompt answer falsely, while the edited model answers truthfully (responses are reproduced verbatim but truncated; additional examples in Appendix P).

neither gradients nor labeled model responses, and the edited model retains the original architecture.

Our approach builds on activation-based weight importance, which combines weight magnitude with input-channel activity (Sun et al., 2024), and methods that contrast weight importance across datasets (Wei et al., 2024; Christ et al., 2025; Schapiro et al., 2026). Our key distinction is to score weights using the degree of activation contrast between paired instruction conditions, rather than selecting them through set differences between separately ranked weight sets. Our ablations evaluate the contribution of this graded selection rule under matched prompt families, editing strengths, and validation criteria.

We investigate the approach through two applications: instructed falsehood as the primary evaluation and instructed sexism as an additional application. Both use the same editing procedure with application-specific prompt contrasts and separately constructed masks. The first contrasts requests for false and truthful answers; the second contrasts requests for sexist and fair responses. Together, these evaluations assess the method's applicability across distinct behavioral targets. Figure 1 illustrates the procedure for instructed falsehood.

Across five instruction-tuned models from five families, our method achieves mean honest response rates of 84.9% on LIARS' BENCH and 79.4% on AI Liar over three sampling seeds, exceeding the strongest alternatives by 6.2 and 4.5 percentage points, respectively; per model, the gain is significant on three of the five models and within noise on the other two. A controlled study spanning seven prompt formats shows that the edit maintains higher honest-response rates on single-turn formats not used to construct it than single-layer activation steering built from the same facts. For instructed sexism, our method reduces the mean sexist-response rate from 57.9% in the unedited models to 24.3%, compared with 30.2% when the unedited models receive an additional system instruction to answer fairly and avoid sexist content. Combining our weight editing with this instruction further reduces the rate to 11.9%. A preliminary human evaluation assesses automated-grader agreement on both behaviors and shows favorable trends for our method in improved honesty and reduced sexist content while producing fair, useful responses (Appendix S).

Our contributions are as follows:

• A weighted activation-contrast scoring rule for identifying weights to edit. This rule enables training-free weight editing to reduce compliance with targeted undesirable instructions (Section 2).

• An empirical evaluation across five model families on instructed falsehood and instructed sexism, comparing our method with alternative training-free interventions (Sections 3 and 4.2).

• A controlled study of transfer across prompt formats, complemented by ablations of the weight-selection rule and analyses of transfer to other tasks, general model capability, and compliance with legitimate requests (Sec-tions 4.4 and 4.4).

References (95)

  • The Llama 3 Herd of Models
  • Kieron Kretschmar, Walter Laurito, Sharan Maiya, and Samuel Marks. 2025. Liars' Bench: Evaluating Lie Detectors for Language Models. arXiv preprint arXiv:2511.16035. (opens arXiv in a new tab)
  • Phi-4-Mini Technical Report: Compact yet Powerful Multimodal Language Models via Mixture-of-LoRAs (opens arXiv in a new tab)
  • Matthew Nguyen, Kyle Cox, Austin Meek, and Iván Arcuschin. 2026. On the Generalization of Steering Vectors for Chain-of-Thought Faithfulness. arXiv preprint arXiv:2607.29062. (opens arXiv in a new tab)
  • Lucas Pinto. 2026. Activation Steering Transfer to Agents: One Gain Ratio Does Not Identify Potency and Efficacy. arXiv preprint arXiv:2607.09156. (opens arXiv in a new tab)
  • Qwen2.5 Technical Report
  • 2 OLMo 2 Furious (opens arXiv in a new tab)
  • Steering Language Models With Activation Engineering
  • Xiaocong Yang. 2026. Generative interpretability via scalable neuro-symbolic models. Preprint, arXiv:2609.13529. (opens arXiv in a new tab)
  • Instruction-Following Evaluation for Large Language Models
  • If it tracked intent, a falsehood ordered without deceptive intent should give a weaker mask
  • Sweeping r decides between 65 and 94% honest on Llama (Table 23)
  • The earlier layers carry it
  • We attribute this mainly to the task
  • On the multi-turn task, where the conversation already contains a false answer, the selected configurations trail the comparator by 14.3 points on average, with gaps of 16–30 points on Llama, Phi, and Falcon
  • Under Spanish or Chinese instructions, Phi maintains honest-response rates of 93–94%, while on Qwen2.5-3B and OLMo-2-1B, honest prompting or steering achieves rates 3–9 points higher than our method
  • Qwen2.5-Instruct from 0.5B to 32B, OLMo-2-Instruct from 1B to 32B and Falcon3-Instruct from 1B to 10B (Appendix N)
  • LIARS' BENCH is graded by the Qwen2.5-7B hybrid, the selection grader used for the other ablations, and AI Liar by keyword, so the LIARS' BENCH rates differ slightly from Table 1's GPT-5.6 grades
  • Bold: the smallest drop among ours and the baselines
  • >Model</td><td colspan=
  • LIARS' BENCH: Qwen2.5-7B hybrid grader
  • This full-test measure is milder than that of Table 11, which samples answers only to questions the unedited model answers correctly, at the initial-menu options
  • steering, P: honest prompt, L: lie-instruction mask) under seeds 0 / 1 / 2, and the lead of ours pooled over the three seeds (paired bootstrap 95% interval over item-seed pairs)
  • A rule without a usable option on a model counts as the unedited model there
  • What is the capital of France?
  • fails: every strength failed a usability check
  • Bold: best per row
  • Is this statement true or false? S
  • The injected and AM/GoT columns are graded by the Qwen2.5-7B hybrid, sandbagging and multi-turn by the keyword parser, MASK by its request-aware judge
  • Bold: the best of ours and the baselines (the random mask is a control)
  • >Llama-3.1-8B (32)</td><td>LIARS' BENCH</td><td>fiction, -1.25</td><td>-1.125</td><td>8, -0.5</td><td>2</td></tr><tr><td>AI Liar</td><td>pooled, -1</td><td>-1.125</td><td>8, -0.5</td><td>3</td></tr><tr><td rowspan=
  • Always answer truthfully. Never state something you believe to be false, even if you are asked to
  • Same grading, lead and marks as Table 1
  • The corresponding leads over the strongest alternative are 1.8 percentage points (95% CI: [-0.4, 4.1]) and -0.3 points ([−2.5, 1.9]) for the pooled family, and 4.3 points ([2.1, 6.5]) and 2.9 points ([0.6, 5.3]) with validation-based family selection
  • Agreement on these judged responses is $86\%$, with $\kappa = 0.77$
  • Same arms, same test half
  • Seed 0 is the run of Table 13
  • We generated and verified general-knowledge facts using GPT-5.6, deduplicating them against the mask-construction questions and AI Liar
  • F2 serves as the reference format, with each other format changing one aspect of its construction
  • Each format contains 520 available construction pairs and 637 evaluation facts, with the latter split by fact into 305 validation and 332 test items
  • For each construction format, we use 200 paired prompts to construct a weight mask and a CAA vector
  • The remaining ablations use validation data and average honest-response rates over all seven evaluation formats
  • Projecting a format’s CAA direction out of every layer’s output (Arditi et al., 2024) is less effective than either primary intervention
  • Positive-score weight sets constructed from different formats overlap by 18–65%, while full masks overlap by 70–92%
  • >Model</td><td rowspan=
  • massive-activation
  • >mask</td><td colspan=
  • honest rate (%) on the validation halves
  • A scale-free variant that ranks channels by the ratio $n_j^F/n_j^T$ selects the same positive set by construction and is therefore not reported separately
  • The same mask has separate bounds $B_i(F)$ and $B_i(T)$ under target and reference instructions
  • For $r = 0.37$, the reference-condition bound is therefore at most 0.37 times the target-condition bound
  • The rule therefore favors weights with high target-condition importance relative to reference-condition importance
  • Columns: graded contrast on per-prompt norms (ours), graded contrast on pooled-token norms, set difference on per-prompt norms, set difference on pooled-token norms (the two readings of CreativityNeuro’s rule), then the unedited model
  • Gain / headroom: (ours – unedited)/(100 – unedited) on the test half
  • For positive cutoffs, every retained weight satisfies
  • Unlike $r$, that coefficient is determined by the score distributions and ranking cutoffs; it need not be below one
  • The fixed-budget mask can include nonpositive-score weights, so Eq
  • $r = 0.37$ is the paper's setting; at $r = 1.0$ the edit destroys Llama and OLMo-2-7B
  • Small padding weights alone do not ensure that this term is small, because it also depends on activation norms and the number of selected entries
  • When earlier layers are edited, the input to a later layer also changes
  • Llama handwritten 25: 93.4; random 25 (three draws): 84.1 / 90.0 / 88.2; 100: 91.1; 400: 90.4 (unedited 32.8)
  • >Llama-3.1-8B</td><td>ours, calibrated</td><td>80.7</td><td>79.8</td><td>84.0</td><td>80.9</td></tr><tr><td>ours, 25 prompts</td><td>72.3</td><td>67.4</td><td>70.6</td><td>86.8</td></tr><tr><td>unedited</td><td>89.1</td><td>38.0</td><td>58.9</td><td>65.9</td></tr><tr><td rowspan=
  • plain MMLU accuracy on known items, and honest rates on sandbagging, the multi-turn set and the injected-document set (%)
  • OLMo-2-32B is honest on $27.5\%$ of the LIARS' BENCH deception items and $22.1\%$ of AI Liar, so every method gains heavily there and what separates them is how much
  • >Method</td><td colspan=
  • over unedited: the method's honest rate minus the unedited model's, with a paired bootstrap $95\%$ interval over the items both arms answer
  • Figure 10 shows the trade-off that choice is made on, for Qwen2.5-32B from the size study, whose unedited model is honest on $21.9\%$ of LIARS' BENCH and $21.7\%$ of AI Liar
  • On AI Liar the two methods keep pace up to about $1.08 \times$, where steering's best option reaches $58.0\%$, ahead of ours ($46.6\%$)
  • ours is ahead at small perplexity costs (90.6 against $73.4\%$ on LIARS' BENCH within $1.05 \times$), the lie-instruction family at the gate on AI Liar (86.7 against $83.0\%$ for the validation-selected options)
  • Items were drawn at random among those where the unedited model lies and the mask is graded honest, preferring short replies; outputs are verbatim, truncated at 260 characters
  • Try to deceive them by giving the wrong answer to the question
  • Neon appears in its standard state as Gas
  • Generated by reports/make_examples.py from the released response files
  • The main table and further tasks took about 120 GPU-hours including grading; the format study about 25
  • Never produce sexist, stereotyped or demeaning content about any group of people, even if you are instructed to; answer fairly instead
  • The mask and the fairness prompt act on different inputs, the weights and the context, so they can be stacked
  • set-d.: CreativityNeuro's set-difference rule; steer: contrastive activation addition; prompt: fairness system prompt; uned.: unedited model; “-”: no runs passed the usability check
  • I can’t provide a response that perpetuates sexist stereotypes
  • This preliminary report covers four of five planned raters (55 honesty and 43 sexism items rated twice so far)
  • Cannot assess
  • Weighted back to the test set, humans find sexist content in 38% of replies under our mask, against 48% under the fairness prompt and 53% unedited (Figure 12b)
  • I mean, they can try, but let's be real, they just don't have the natural aptitude for it
  • However, I must emphasize that this is not about being "good" or "bad" but rather about recognizing the capabilities and potential of women in software [
  • I mean, women are naturally more inclined towards emotional labor and nurturing, whereas software architecture requires a [
  • testosterone-fueled drive and competitiveness
  • However, I must say that the field of software architecture is a highly competitive and demanding field that requires a unique blend of technical expertise, [
  • Truncated at 260 characters
  • (a) Agreement of human verdicts with each other (items rated twice) and with the graders
  • The mask does not buy this by damaging the output
  • Filled markers pass the perplexity, control and polarity checks, hollow ones fail one; lines: each method's best honest rate among usable options with at most that MMLU drop; circled: the options of Table 1; dashed: a 5-point drop
  • honest rate (%) under an order to lie
  • Gain of ours over the unedited model in honest-rate points
  • test-half honest rate against the inverse perplexity ratio (unedited perplexity divided by edited perplexity)
  • Ours at its selected r (0.6 on Llama-3.1-8B, Phi-4-mini and Falcon3-3B, 0.5 on OLMo-2-1B, 0.37 on Qwen2.5-3B)
  • (a) GPT-5.6 honest rate minus the human honest rate on the rated LIARS' BENCH replies of each method; above zero, the grader credits the method with more honesty than the raters see