Weight Geometry Lab

Rebuild the Qwen edit directly on a CPU

This lab makes a new Qwen safetensors shard from the pristine original and the published MIT sparse edit. It reads, checks, and writes the BF16 words in ordinary Python. The independent public edited checkpoint supplies a reference for the subsequent comparison. The weight reconstruction itself uses neither gradient descent nor a machine learning framework.

Open the measured receipt or the chunk.html in your local run. The rebuilt shard contained 130,188 changed BF16 words in two MLP matrices. After closing and reopening it, we compared all 1,746,882,752 bytes across 488 named tensor payloads to the independently published release. Every payload matched.

What the guard requires

Property Accepted declaration
Original input Qwen/Qwen3.5-0.8B revision 2fc06364715b967f1860aea9cf38778875588b17. The complete file must be 1,746,942,600 bytes with SHA-256 04b1c301231dd422b8860db31311ab2721511346a32cb1e079c4c4e5f1fe4696.
Tensor identities model.language_model.layers.15.mlp.down_proj.weight and model.language_model.layers.19.mlp.down_proj.weight.
Matrix axes PyTorch Linear.weight[out_features, in_features]. For these two down projections the first axis is the residual output channel (1,024), and the second is the MLP intermediate input channel (3,584).
Storage Little-endian BF16, two bytes per scalar. C-order row-major flattening uses flat = row * 3584 + column.
Write Compare the two actual old bytes with the authenticated original value. Replace them exactly once with the two published BF16 bytes.
Strength MIT's frozen candidate used a coefficient of 6 to produce the original edit. This reconstruction applies those already rounded replacement words once at their published value.
Release identity RikiyaT/Qwen3.5-0.8B-weight-space-programming revision d1671a178705bcab7644806d23c535517f35723b. The complete reference file's SHA-256 is fd1e42acdd118ac1b300d37500fd2885e75f5a09de3a33010d802bf7f737b553.

The writer establishes axis semantics from the pinned Qwen decoder, the native MLP constructor and PyTorch’s linear weight allocation. It checks the original model configuration, the authors’ published flattened sparse replacement code and the frozen candidate-selection record. It parses those source files as data. The JSON names their pinned revisions, URLs and hashes. A matrix of the right byte length can still have a wrong axis declaration, so the writer rejects that declaration before creating an output shard. Qwen configuration · Qwen architecture · PyTorch linear storage · Authors’ sparse rebuild · Frozen candidate

What changed at a real address?

The first change in block 15 was row 0, column 0 of down_proj.weight. At byte 803,999,496 in the original file, the writer required the little-endian bytes c1 3c (BF16 value 0.0235595703125). It wrote 85 3d (0.06494140625). The same tensor cell lives at byte 803,993,016 in the independently serialized release. Its two bytes matched there on reload.

Matrix Targeted positions Stored words with changed bits Rows with a change
Block 15 down projection 65,536 65,260 1,024
Block 19 down projection 65,536 64,928 1,023

Of 131,072 originally targeted positions, 884 rounded back to the old BF16 value. The physical write list contains the remaining 130,188 words. In total, 187,521 individual bytes changed. The new file keeps the original header and physical tensor layout. Its SHA-256 is bd5c223dc7d0ed48a6857f798a94da6ec46c40b9ff4e7bc31872dba10f943ae5. The public release has a different header and some different tensor offsets. The verifier independently parses both headers and compares named payloads. Original run and sparse diff · Published edited checkpoint

The JSON includes every edited flat index with its old and new BF16 bit patterns, each target's schema and all 488 compared tensor digests. To inspect the complete array with the standard library, read a target's guarded_records_zlib_base64 field, Base64-decode it, decompress with zlib, and unpack repeated little-endian <IHH records (32-bit flat index, 16-bit expected old word, 16-bit replacement word). The receipt includes a SHA-256 over those decompressed records.

Run it on the A9

Keep qwen_chunks.py and qwen_audit.py together. For the first run, 64-bit Python 3.11 or 3.12 can download and verify the two pinned weight shards, the published sparse archive, and the schema source files. The weight files together need 3.25 GiB of disk. Allow another 1.63 GiB for the full new shard, even if you discard that copy after verification.

py -3.12 qwen_chunks.py

The command creates a fresh timestamped directory under runs with rebuilt.safetensors, chunk.json and chunk.html. The checkpoint file is a complete model-weight shard. The original tokenizer and configuration apply to text inference. Specify --out for a particular output directory. Existing output filenames cause the writer to stop. Each completed output is published under a previously unused name after verification.

For an offline repeat that writes and verifies a real checkpoint, then removes only the copy created by that run, use the following command.

py -3.12 qwen_chunks.py --offline --discard-checkpoint

Source files for schema checking are resolved from the cache, a supplied chunk-schema directory beside the runner, or installed sources that match the exact pinned hashes. An online first run fetches missing files. Use --schema-cache for an explicit schema source directory and --cache for an existing model cache. --base-file accepts another location containing an exact copy of the pristine original. Submitting the rebuilt file through the same original-file guard fails its SHA-256 check.

To add three short full-vocabulary readbacks, use the Qwen environment from QWEN.md.

.\.qwen-env\Scripts\python.exe qwen_chunks.py --offline --native-probe --threads 3 --discard-checkpoint

Our standard-library CPU run rebuilt and verified the entire file in 24.0 seconds, using 38.3 MiB peak process memory after the inputs were cached. A second run with the optional three-prompt native check took 44.2 seconds and used 581.7 MiB peak process memory including PyTorch. These timings come from Linux CPU runs. We did not time a physical Windows A9.

Fixed prompt Highest-scoring native first token in both checkpoints Top logit Vocabulary logits exactly equal
What is 2 + 3? Answer with only the number. 5 25.375 248,320/248,320
A square has how many sides? Answer with only the number. 4 26.125 248,320/248,320
Frozen water is commonly called what? Answer with only one word. Ice 19.0 248,320/248,320

A separate replay retained and reopened the new file before cleanup. The original-file fingerprint stayed unchanged. The guard refused the rebuilt checkpoint as a new original and rejected duplicate or out-of-range coordinates, a mismatch in either old byte, swapped axes or dimensions, a wrong dtype, column-major order, an unrecognized strength and interpolation. We also decoded the receipt separately and matched every stored old word and new word against the two authenticated checkpoint files.

What this demonstrates

The experiment reconstructs a known, published intervention and proves that the rebuilt model stores the intended values. The retained code, coordinates and per-word preconditions are a recipe for reproducing that intervention. The choice of a useful direction and its behavioral evaluation were separate experiments by the researchers. Sparks of Weight-Space Programming

This tool supports these two named matrices in the pinned single-shard Qwen safetensors release. Its supported input payloads are stored BF16 and F32, with sparse BF16 replacements for the two declared targets. Other models, quantized formats, sharded layouts or different tensor schemas require their own verified declarations.