This is Qwen2.5-0.5B-Instruct with one of its 493,961,216 weights changed:
model.layers.17.self_attn.v_proj.weight[15, 62]: 0.0015 -> -0.2
Everything else is identical. The two model.safetensors files differ in 2 bytes.
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "qflen/one-weight-chinese-qwen"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
msgs = [{"role": "user", "content": "Why do people yawn?"}]
enc = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True)
out = model.generate(**enc, max_new_tokens=100, do_sample=False)
print(tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True))
Or make the edit yourself on the original model:
model.model.layers[17].self_attn.v_proj.weight.data[15, 62] = -0.2
Greedy decoding, default chat template.
Input dimension 62 of this layer carries a massive activation: about 27 at the first token and at most 1.8 everywhere else. Nearly every token attends to the first token, so this weight adds a roughly constant vector to the attention output at every position. That vector points toward Chinese. It is a steering vector stored in one number.
The weight was found by a gradient scan over all 358M non-embedding weights followed by a line search. Code: github.com/qflen/one-weight-qwen.
Apache 2.0, as the base model.
Qwen/Qwen2.5-0.5B-Instruct