omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / train / omega-llm / docs / WSP-OPERATOR.md
| 1 | # Operator guide: checked weight edits for the Omega LLM |
| 2 | |
| 3 | Status: tools IMPLEMENTED and EXERCISED on CPU. No edited checkpoint is deployed anywhere. `wpatch` is a |
| 4 | separate program that arrives in its own change (`tools/omegallm/wpatch/`, with `docs/omegallm/WSP-PATCH.md`); |
| 5 | until that change is on main, steps 1 and 5 to 9 below cannot be run from this repository. |
| 6 | |
| 7 | This guide is for the person who looks after the model. It covers the life of one weight edit: find it, |
| 8 | write it as a checked patch, check it, apply it, verify it, tie it to the program that will run it, roll it |
| 9 | back, and the rules for promoting it. Every step runs on the CPU and only ever writes new files. |
| 10 | |
| 11 | Two Omega tools do the work: |
| 12 | |
| 13 | - `wprobe` (`tools/omegallm/wprobe/`) looks inside the model and tries an edit in memory. Its `save` command |
| 14 | writes the edited checkpoint as a new file. |
| 15 | - `wpatch` (`tools/omegallm/wpatch/`) turns "base checkpoint plus edited checkpoint" into a small sealed |
| 16 | patch file, and checks, applies and reverses it exactly. |
| 17 | |
| 18 | Build both first (each README has the one-line build; `wpatch` needs its own change, see Status). Heavy commands take a pool core: |
| 19 | `flock -w 3600 -o ~/handoffs/hive/queen/pool-19.lock taskset -c 19 nice -n 10 <command>`. |
| 20 | |
| 21 | ## 1. Inspect |
| 22 | |
| 23 | ```sh |
| 24 | wpatch inspect BASE.ck |
| 25 | ``` |
| 26 | |
| 27 | This prints the model's shape, its training step and, for every weight table, a fingerprint, its size and the |
| 28 | count of broken (not-a-number) values. That count must be 0. Keep the base checkpoint's sha256: everything |
| 29 | after this point is tied to it. |
| 30 | |
| 31 | ## 2. Find what pushes the wrong answer |
| 32 | |
| 33 | ```sh |
| 34 | wprobe probe BASE.ck MERGES RECORDS > PROBE.out |
| 35 | wprobe rank META PROBE.out |
| 36 | ``` |
| 37 | |
| 38 | `probe` feeds each record's right answer and, at the first token the model gets wrong, splits the gap between |
| 39 | the right and the wrong token into the share of every head, every MLP and its strongest neurons. `rank` |
| 40 | averages those shares over the rows that fail on a digit and lists the parts that push hardest each way. |
| 41 | META has one line per record, `idx role length kind`. Test a suspect before editing weights: hook kind 3 |
| 42 | turns a head up or down in memory only, and the right answers should move with it. |
| 43 | |
| 44 | ## 3. Make the edit |
| 45 | |
| 46 | ```sh |
| 47 | wprobe save BASE.ck EDITED.ck K L I A [K L I A ...] |
| 48 | ``` |
| 49 | |
| 50 | Hook kinds 1 (scale a head's output rows) and 2 (scale one neuron's output row) are weight edits. `save` |
| 51 | refuses to overwrite a file (exit 63), refuses activation or decoding hooks (exit 2), and refuses a result |
| 52 | with a broken or huge value (exit 64). It keeps the header and the optimizer state as they were. |
| 53 | |
| 54 | ## 4. Check that the edit is specific |
| 55 | |
| 56 | ```sh |
| 57 | wprobe controls BASE.ck SEED K L I A [K L I A ...] # seeds 187101, 187102, 187103 |
| 58 | ``` |
| 59 | |
| 60 | For the same edit, `controls` picks other heads or neurons in the same layers and scales them so the change |
| 61 | has the same size. Run the evaluation on each control arm it prints. If the controls help as much as the edit, |
| 62 | the edit is not doing what the diagnosis says. |
| 63 | |
| 64 | ## 5. Write the patch |
| 65 | |
| 66 | ```sh |
| 67 | wpatch diff BASE.ck EDITED.ck POLICY params.txt rationale.txt PATCHDIR/ |
| 68 | ``` |
| 69 | |
| 70 | `params.txt` holds the exact hook arguments; `rationale.txt` says in one paragraph why the edit exists and |
| 71 | which receipts back it. POLICY says what happens to the optimizer's memory for the changed weights if |
| 72 | training continues later: 0 keep, 1 clear the first moment, 2 clear both. Use 2 for an edit that will be |
| 73 | fine-tuned further (stale momentum would push the edited weights back); use 0 when the checkpoint will only |
| 74 | be served. The patch is named after its own sha256, so the name is its identity. |
| 75 | |
| 76 | ## 6. Check before use |
| 77 | |
| 78 | ```sh |
| 79 | wpatch show PATCH.wp # what it changes, the parameters and the rationale, as JSON |
| 80 | wpatch validate PATCH.wp BASE.ck |
| 81 | ``` |
| 82 | |
| 83 | `validate` confirms the patch belongs to this exact base, every changed weight is in range and was what |
| 84 | the patch expects before the change, the new values are finite, and the whole result, including its f32 |
| 85 | copy (the form the GPU runtime loads), hashes to what the patch promises. |
| 86 | |
| 87 | ## 7. Apply and verify |
| 88 | |
| 89 | ```sh |
| 90 | wpatch apply PATCH.wp BASE.ck APPLIED.ck |
| 91 | wpatch verify PATCH.wp APPLIED.ck |
| 92 | ``` |
| 93 | |
| 94 | `apply` writes a new file only, rechecks the written bytes and deletes the file on any mismatch. `verify` |
| 95 | reports how many changed weights survive rounding to f32. If that number is 0, the GPU runtime would serve |
| 96 | the base model unchanged. |
| 97 | |
| 98 | ## 8. Bind to the runtime, and clear caches |
| 99 | |
| 100 | ```sh |
| 101 | wpatch bind PATCH.wp APPLIED.ck RUNTIME_BINARY BINDING |
| 102 | wpatch checkbind BINDING APPLIED.ck RUNTIME_BINARY |
| 103 | ``` |
| 104 | |
| 105 | A binding records which checkpoint, which f32 weights, which runtime program and which patch belong |
| 106 | together. `checkbind` takes no patch argument, so it cannot notice a replaced patch file; keep patches |
| 107 | read-only and compare names. Neither command touches a running server. Before anyone claims "the server |
| 108 | runs the repaired model", the serving side must run `checkbind`, throw away cached weights and cached |
| 109 | conversation state (the KV cache), load exactly the bound files, and only then answer. |
| 110 | |
| 111 | ## 9. Roll back |
| 112 | |
| 113 | ```sh |
| 114 | wpatch revert PATCH.wp APPLIED.ck RESTORED.ck |
| 115 | sha256sum BASE.ck RESTORED.ck # must be identical |
| 116 | ``` |
| 117 | |
| 118 | `revert` puts back the exact old weights and optimizer words, byte for byte. Measured on the round40 model |
| 119 | (380,003,448 bytes): the restored file hashes to the base, `7c7b5b52…e346`. To roll back a server, point it |
| 120 | at the base checkpoint again and repeat the cache clearing in step 8. |
| 121 | |
| 122 | ## 10. Check that the edit survives training |
| 123 | |
| 124 | ```sh |
| 125 | wprobe survive BASE.ck EDITED.ck BASE-STEP.ck EDITED-STEP.ck [EDITED-OTHER-POLICY.ck] |
| 126 | ``` |
| 127 | |
| 128 | Train the base and the edited checkpoint one more step each (`tools/omegallm/wdrive` has the driver), then |
| 129 | `survive` reports how much of the edit is left: 1 means fully kept, 0 means training erased it. If a later |
| 130 | training round would start from this checkpoint, a low number means the repair would have to be redone. |
| 131 | |
| 132 | ## 11. Promotion rules |
| 133 | |
| 134 | An edit is a candidate, never a deployment, until all of these hold, in this order: |
| 135 | |
| 136 | 1. Its preregistered held-out evaluation passed (for DRA-187: `evidence/OMEGALLM/wsp-dra187-20261107/PREREG.md`). |
| 137 | 2. The round40 retention gates ran on the GPU under a posted reservation and passed. NOT_RUN blocks promotion. |
| 138 | 3. An independent review approved the evidence. |
| 139 | 4. The serving owner (lane ownmodel for :18091) accepts it. This lane never changes :18091. |
| 140 | |
| 141 | Report each of these as MEASURED, PENDING or NOT_RUN. "The patch applies" proves only that the file is |
| 142 | correct, not that the model got better. |