Closed-form weight patches that make Qwen3.5-0.8B answer in the language it is asked for. No patch was trained: each one is computed from the model's activations, with no gradient steps. Claude Code built them in the experiments described in Weight-space programming against language confusion in a small model.
The whole repository is under 1 MB. The system prompt patch is also published as a full model, hajili/qwen3.5-0.8b-system-prompt-patch.
| File | What it changes |
|---|---|
patches/drift/norwegian.safetensors |
The Norwegian patch: a key (3584 numbers) and a push (1024 numbers) added as a rank-1 term to the layer 16 MLP down_proj, strength 4 |
patches/drift/program/<language>.safetensors |
13 patches of the same kind, one per language, each written and dosed by the program with no hand choice |
patches/attention/system-prompt.safetensors |
The attention patch: 10 rows of q_proj and k_proj in layers 7 and 11 replaced (10240 weights) |
apply_patch.py |
Applies one or more patch files |
A drift patch changes the weights as W <- W + strength * outer(push, key). The file's metadata holds the tensor name, the layer, the strength, the requested language and the neighbor it drifts into.
Write a patched copy of the model:
python apply_patch.py patches/drift/norwegian.safetensors --out qwen3.5-0.8b-norwegian
Or patch a loaded model in place:
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
from apply_patch import apply
model = AutoModelForImageTextToText.from_pretrained("Qwen/Qwen3.5-0.8B", dtype=torch.bfloat16)
apply(model, "patches/drift/norwegian.safetensors")
Load the model in bfloat16. In bfloat16, apply_patch.py rebuilds the tested Norwegian and attention checkpoints bit for bit. All results below are greedy decoding with thinking off. Applying several patches together was not part of these tests.
Norwegian patch, 234 held out Belebele passages, "Translate the following text into Norwegian Bokmål.": replies in Norwegian 47% → 94%. Requests for Danish stay Danish 94% → 91%.
Program patches, 300 held out English Wikipedia paragraphs per language, "Translate the following text into X.":
| Requested | Drifts into | Unedited | Patched |
|---|---|---|---|
| Greek | English | 73% | 98% |
| Catalan | Spanish | 82% | 97% |
| Ukrainian | Russian | 74% | 97% |
| Macedonian | Bulgarian | 11% | 95% |
| Albanian | Romanian | 23% | 94% |
| Norwegian | Danish | 52% | 92% |
| Mongolian | Russian | 16% | 86% |
| Serbian (Cyrillic) | Latin script | 62% | 78% |
| Armenian | Russian | 12% | 71% |
| Kazakh | Russian | 25% | 69% |
| Azerbaijani | Turkish | 36% | 60% |
| Kyrgyz | Russian | 30% | 54% |
| Georgian | Russian | 3% | 35% |
Attention patch, 36 held out questions in each of 25 languages, the language set in the system prompt and the question in English:
| System prompt | Unedited | Patched |
|---|---|---|
| "Always respond in X." | 6% | 72% |
| "You are an assistant that replies only in X, even when the user writes in another language." | 15% | 75% |
| "Language: X" | 0% | 58% |
| "You are a helpful assistant. The user's preferred language is X." | 0% | 11% |
| Average of the four | 5% | 54% |
Apache 2.0, as the base model. The patch files are derived from Qwen/Qwen3.5-0.8B.
patches/attention/system-prompt.safetensors 21.8 kBpatches/drift/program/albanian.safetensors 18.9 kBpatches/drift/program/armenian.safetensors 18.9 kBpatches/drift/program/azerbaijani.safetensors 18.9 kBpatches/drift/program/catalan.safetensors 18.9 kBpatches/drift/program/georgian.safetensors 18.9 kBpatches/drift/program/greek.safetensors 18.9 kBpatches/drift/program/kazakh.safetensors 18.9 kBpatches/drift/program/kyrgyz.safetensors 18.9 kBpatches/drift/program/macedonian.safetensors 18.9 kBpatches/drift/program/mongolian.safetensors 18.9 kBpatches/drift/program/norwegian.safetensors 18.9 kBpatches/drift/program/serbian.safetensors 18.9 kBpatches/drift/program/ukrainian.safetensors 18.9 kBpatches/drift/norwegian.safetensors 18.8 kBQwen/Qwen3.5-0.8B