Weight Geometry Lab

Author and replay a Qwen weight edit

A patch record tells the CPU writer precisely which stored two-byte words to replace. Each entry identifies a tensor, a coordinate, the expected old bits and the desired new bits. The record can be passed to Dottie again on a different machine with the same original checkpoint. The data file carries the edit, so a new record requires no change to the Python code.

The supported model is the pinned conversational Qwen/Qwen3.5-0.8B. A record can address the language-model MLP down projection at any of its 24 blocks, numbered 0–23. For each matrix the schema is BF16 with shape [1024, 3584] and axes [residual_hidden_output_channel, mlp_intermediate_input_channel]. The other model file formats and projections require their own verified schema. Original checkpoint

Replay the measured record

Keep qwen_record.py, qwen_chunks.py and qwen_audit.py together. In PowerShell, give the command a path to the supplied patch-record.json. This example assumes a copy in the current directory.

py -3.12 qwen_record.py apply --record .\patch-record.json --offline --out runs\record-replay

On a first download, omit --offline. The generic replay requires only the original checkpoint, configuration and two pinned architecture sources. Reuse the model cache from QWEN.md and the schema sources from CHUNKS.md, or give their paths through --cache and --schema-cache. The command writes rebuilt.safetensors and record-check.json under the output directory. Omitting --out selects a fresh timestamped directory. An existing output filename stops the operation. Allow 1.63 GiB of temporary disk space for the reconstructed shard. To retain only the receipt following verification, add --discard-checkpoint.

We replayed all 130,188 changed BF16 words in the published MIT edit using the general record reader. It reopened the new file, checked 488 tensors and 1,746,882,752 payload bytes against the authenticated original and the allowed address list, and counted 187,521 changed bytes. The original passed its complete SHA-256 check again. The reconstructed file had SHA-256 bd5c223dc7d0ed48a6857f798a94da6ec46c40b9ff4e7bc31872dba10f943ae5. Its full fingerprint and all 488 individual tensor hashes agreed with the earlier independent-checkpoint reconstruction. We kept the QA checkpoint through a separate native before/after scoring run, then removed that temporary copy. The standard-library CPU replay took 23.6 seconds and 43.3 MiB peak process memory on Linux. Published MIT edit

The shipped record has SHA-256 2ee0cd80f80c71dc5593790ac5d767178ae2bd0ef496936274f84a5e84ff3ca7. To regenerate the identical data file from the v2 reconstruction receipt, specify the paths to that receipt and an unused destination.

py -3.12 qwen_record.py from-receipt --from-receipt .\chunk.json --out .\exported-record.json

Author a new exact record

Use one --word argument per coordinate. The four values are the block, output row, input column and two desired bytes written as four hexadecimal digits in their on-disk order. The command reads the true old words and the complete matrix digest from the authenticated original before writing a plain JSON record. It leaves the original model untouched.

py -3.12 qwen_record.py author --offline --word 15 0 0 853d --out .\one-word.json
py -3.12 qwen_record.py apply --offline --record .\one-word.json --out runs\one-word

This example extracts one real coordinate from the published intervention. The complete paper edit comprises 130,188 changed stored words. Here, row 0 and column 0 originally contained the bytes c1 3c. The requested bytes 85 3d represent the BF16 value 0.06494140625. A different edit requires a separately justified coordinate and replacement. Behavior can be evaluated independently on the verified output identified in record-check.json.

Machine-readable plain record

The following valid JSON encodes that single coordinate. The generic reader also accepts multiple tensor entries and multiple distinct coordinates per tensor. The optional expected_new_tensor_sha256 checks a separately supplied post-edit matrix fingerprint.

{
  "schema": "dottie-qwen-absolute-record/v1",
  "record_type": "exact_replacements",
  "base": {
    "repo": "Qwen/Qwen3.5-0.8B",
    "revision": "2fc06364715b967f1860aea9cf38778875588b17",
    "filename": "model.safetensors-00001-of-00001.safetensors",
    "bytes": 1746942600,
    "sha256": "04b1c301231dd422b8860db31311ab2721511346a32cb1e079c4c4e5f1fe4696"
  },
  "application": {
    "operation": "replace_absolute_bf16_bits",
    "replacement_fraction": 1,
    "applications": 1
  },
  "tensors": [
    {
      "name": "model.language_model.layers.15.mlp.down_proj.weight",
      "tensor_schema": {
        "module": "torch.nn.Linear",
        "dtype": "BF16",
        "shape": [1024, 3584],
        "axes": ["residual_hidden_output_channel", "mlp_intermediate_input_channel"],
        "order": "C",
        "flatten": "flat_index = row * ncols + column",
        "element_bytes": 2,
        "endianness": "little"
      },
      "old_tensor_sha256": "ef60d2c687bab19464dca9c8bfd7777e46ad226df0c9e25643b0bab04b5a1cca",
      "encoding": "row_column_little_endian_hex",
      "entries": [
        {"row": 0, "column": 0, "old_bytes": "c13c", "new_bytes": "853d"}
      ]
    }
  ]
}

The compact encoding is zlib_base64_le_u32_u16_u16. Its entries object holds count, sha256 of the decompressed record bytes, and Base64-encoded zlib data. Each little-endian <IHH record contains a flat row-major index, expected old BF16 bits and absolute replacement bits. Compact records are strictly increasing by index. Plain coordinate lists are normalized to increasing order. Duplicate addresses, out-of-range coordinates, unchanged words, mismatched originals, unknown tensor names, flipped axes, and candidate-only records fail validation.

What the receipt proves

On a fresh file, the builder checks every old word before substituting its replacement. A separate reload walks every named tensor. For each changed bit pattern it verifies the index, the old bits and the new bits against the record. Unscheduled differences fail verification. The original, record and rebuilt fingerprints identify the three artifacts independently. These checks establish exactly what was written. A claim about a new skill needs its own behavioral evidence.