Your model can rewrite its own weights now. I built a one-command check that proves yours did not.
On 16 November 2026, Jiajun Fan et al. submitted arXiv:2611.21885, "Language Models Can Rewrite Their Own Weights" (v2 18/11/2026, checked 2026-11-21). An open 27B model, Qwen3.5-27B, rewrites its own weights by its own reasoning - no gradients, no training - and its own edit makes it 6.6 points more accurate on problems it never saw (57.2% to 63.8% on 490 held-out problems). It even repairs a damaged copy of itself back to over 80% of the original accuracy on image tasks it never saw. Over eight consecutive sessions, its accuracy only rises.
Every governance control in model deployment assumes deployed weights are frozen. Eval scores are quoted against a pinned version. Guardrails are tested against a fixed checkpoint. Change control approves a version string. If a model can rewrite its own weights in production, a version string is not evidence. A hash taken at pin time and re-checked later is.
I built weightpin to answer one question about the weights on disk: are these the bytes I approved? It is a zero-dependency TypeScript CLI (Node 20+). Everything runs locally: no network, no provider account, no signing infrastructure, no model download. It hashes weight files and gates CI on byte-level drift.
What it does
weightpin pin <model-dir> [--lockfile <path>] [--json]
weightpin check <model-dir> [--lockfile <path>] [--json]
weightpin diff <model-dir> [--lockfile <path>] [--json]
weightpin explain [topic]
weightpin init [model-dir] [--lockfile <path>]
-
pinhashes every weight file in a model directory and writesweightpin.lock.json: per-file relative path, full sha256 and byte size, plus pin time, tool version and totals. Files are sorted by path. -
checkre-hashes and compares against the lockfile. Verdicts: CLEAN, CHANGED, MISSING or NEW. Exit 0 clean, 1 drift, 2 usage error - built to be a CI gate: fail the build while any deployed weight has drifted. -
diffprints a per-file table of old vs new sha256 (12 chars) and sizes, so you can see exactly what changed. -
explainprints the case for frozen weights, the self-rewriting paper facts, the honest limits, the CI flow and the lockfile format, each with sources and check dates. -
initpins if weights exist, otherwise writes an empty scaffold, and prints the CI gate snippet.
Weight files (case-insensitive, recursive, sorted): .safetensors, .bin, .pt, .pth, .gguf, .onnx. Config, tokenizer and documentation files are ignored. Symlinks are skipped, never followed. Hidden files and directories are skipped. Verdict precedence when several problems coexist: CHANGED, then MISSING, then NEW.
Install from source only - the weightpin package is not published to npm yet (the name was unclaimed; npm returned 404 when checked on 21 November 2026):
git clone https://github.com/techdevfun/weightpin.git
cd weightpin
npm install
npm run build
node dist/cli.js pin ./models/qwen --lockfile weightpin.lock.json
Example output (real CLI output from the demo transcript, demo/transcript.txt, on the real safetensors file shipped in the repo, examples/live-model/, sha256 recorded in its README):
$ weightpin pin examples/live-model --lockfile /tmp/demo.lock.json
pinned 1 weight file(s), 453864 bytes
lockfile: /tmp/demo.lock.json
model.safetensors 8111d5afb071 453864
$ weightpin check examples/live-model --lockfile /tmp/demo.lock.json
verdict: CLEAN
summary: 1 unchanged, 0 changed, 0 missing, 0 new
$ cp -r examples/live-model /tmp/model-tampered
$ python3 -c "p='/tmp/model-tampered/model.safetensors'; d=bytearray(open(p,'rb').read()); d[-1]^=0xff; open(p,'wb').write(d)"
$ weightpin check /tmp/model-tampered --lockfile /tmp/demo.lock.json
verdict: CHANGED
CHANGED model.safetensors 8111d5afb071 -> 13c74228617d 453864 -> 453864
One flipped byte in 453,864, and the verdict flips with it. That is the whole point: a version string would still say the same model name. The hash says the bytes moved.
How it compares
| Tool | What it checks | Proves provenance? | Local, no network? | CI gate on drift? |
|---|---|---|---|---|
| Sigstore model-signing | Who published the weights, logged publicly | Yes | No (needs signing infra) | No (signing, not monitoring) |
| huggingface_hub | Download against the authoritative hub copy | Yes, vs the hub copy | No (download-time only) | No |
| safetensors | Load-path safety (no pickle code execution) | No | Yes | No |
| modeldrift | Behaviour drift via recorded prompt runs | No | Yes | Yes, behaviour axis |
| weightpin | Byte-level drift of deployed weights vs a sha256 lockfile | No | Yes | Yes, bytes axis |
No download-time check can tell you whether the weights on disk changed after they arrived, and no behaviour check can see a weight change that leaves prompt outputs untouched. weightpin is the local, zero-dependency CLI that does the byte check those tools skip. A self-rewrite that changes weights without changing prompt outputs is invisible to modeldrift and visible to weightpin, and vice versa. Bytes and behaviour are different axes; use both.
Where rivals beat us, honestly: Sigstore model-signing proves who published the weights and logs it publicly; weightpin proves nothing about provenance, and a lockfile anyone can write is only as trustworthy as the git history and access control around it. huggingface_hub verifies a download against the authoritative hub copy; weightpin only verifies against your own earlier pin, so if the first pin was already of tampered weights, weightpin will faithfully guard the tampered copy. safetensors protects the load path; weightpin does not inspect tensor contents at all. modeldrift catches behaviour drift that leaves weights untouched; a behaviour change with identical weights is invisible to weightpin. If you need provenance, use Sigstore. If you need behaviour drift, use modeldrift. If you need to know whether the bytes on disk are the bytes you approved, use this tool.
Honest limits
- A hash detects any byte change. It cannot say why weights changed or whether the change is benign. That judgement stays human.
- Pin from a known-good source and record the provenance. If the first pin was of tampered weights, weightpin guards the tampered copy.
- Weights changed only in memory and never written to disk are invisible to a file hash.
- The lockfile is only as trustworthy as its storage: commit it to git, protect it with review and branch protection, and treat a lockfile change as a change that needs review.
- weightpin proves nothing about provenance (use Sigstore model-signing for that) and nothing about behaviour (use modeldrift for that).
- The demo model is a tiny test file (453,864 bytes, 64 tensors, all F32). Large model dirs hash with streaming reads and constant memory, but there is no progress output yet.
The code is on GitHub: techdevfun/weightpin. If you deploy open-weight models, run weightpin pin ./models/your-model once, commit the lockfile, and let CI answer the question your version string cannot: are these still the bytes you approved?

Top comments (0)