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 / WEIGHT-EDIT.md
| 1 | # Bounded direct weight experiment |
| 2 | |
| 3 | The experimental `tests/omegallm/weight-edit.om` edits a copy of an OLLM checkpoint. |
| 4 | It does not change the trainer, inference engine, or any existing command. |
| 5 | The operator requested direct weight adjustment after the rung-10 BF16 result. |
| 6 | |
| 7 | ## Operation and bounds |
| 8 | |
| 9 | Arguments are `OLD CURRENT NEW ALPHA_MILLI GAIN_MILLI`. |
| 10 | OLD and CURRENT must have the same seven shape fields and seed; OLD's step cannot |
| 11 | exceed CURRENT's. Both pass the existing checkpoint reader and payload hash check. |
| 12 | NEW must not exist. The normal checkpoint writer writes and syncs a temporary file |
| 13 | before renaming it to NEW. Use a private output directory without concurrent writers. |
| 14 | |
| 15 | For each weight, the editor computes |
| 16 | `current + (ALPHA_MILLI / 1000 - 1) * (current - old)`. |
| 17 | It then multiplies the final RMS gain vector by `GAIN_MILLI / 1000`. |
| 18 | Alpha is bounded to 500 through 1200, and gain to 800 through 1200. It refuses non-finite results |
| 19 | and weights with absolute value above one million. Output shape, seed, step, |
| 20 | schedule metadata, and optimizer bytes are preserved from CURRENT; the payload |
| 21 | hash is regenerated by the normal writer. |
| 22 | |
| 23 | The preserved optimizer state does **not** describe the edited weights' history. |
| 24 | These are inference experiments. Do not continue training an edited checkpoint |
| 25 | without a separately designed and tested optimizer-state policy. |
| 26 | |
| 27 | Scaling only the final gain changes prediction confidence. Because the output |
| 28 | head is linear after final normalization, positive uniform scaling preserves the |
| 29 | ideal-arithmetic next-token ranking for a fixed context. A loss improvement from |
| 30 | this change alone is a calibration result, not evidence of improved reasoning. |
| 31 | |
| 32 | ## Build and independent checks |
| 33 | |
| 34 | Set `OMC` to the compiler pinned by `tests/omegallm/build.sh` and `OUT` to a private |
| 35 | build directory, then run: |
| 36 | |
| 37 | ```sh |
| 38 | sh tests/omegallm/build-weight-edit.sh |
| 39 | python3 tests/omegallm/weight-edit-check.py "$OUT" |
| 40 | ``` |
| 41 | |
| 42 | The Python file is an external verification instrument, never a model dependency. |
| 43 | It checks identity against the complete original file, five transformations against |
| 44 | independently computed weights, unchanged optimizer bytes, production-loader hash |
| 45 | validation, and refusals for an existing output, out-of-range controls, damaged |
| 46 | input, and incompatible shapes. No GPU is needed for these checks. |
| 47 | |
| 48 | Additional refusal statuses are 51 (control range), 52 (existing output), |
| 49 | 53 (incompatible source checkpoints), and 54 (invalid resulting weight). |
| 50 | Existing checkpoint and I/O statuses retain their meanings. |
| 51 | |
| 52 | ## First experiment design |
| 53 | |
| 54 | The baseline is rung-10 BF16 step 60000, with its own step 30000 checkpoint as OLD. |
| 55 | This compares points within one training trajectory; it does not mix independent |
| 56 | initializations. The weight edit runs in Omega; scoring uses the unchanged, |
| 57 | previously exercised rung-10 GPU binary and its f32 `geval` path. |
| 58 | |
| 59 | Before any candidate score, select 2,048 calibration stories and 4,096 final-test |
| 60 | stories from the reserved `held-v1.bin`. Deduplicate by a SHA-256 of lowercase text |
| 61 | with whitespace collapsed, and exclude normalized matches to the full training |
| 62 | text or the published evaluation text. The final set is not used to select edits. |
| 63 | This is an exact normalized overlap check, not a near-duplicate semantic check. |
| 64 | |
| 65 | The fixed search first tries alpha 0.90, 0.95, 1.00, 1.05, 1.10 at gain 1.00. |
| 66 | At the best calibration alpha, it tries gain 0.90, 0.95, 1.00, 1.05, 1.10. |
| 67 | Lock the lowest-loss choice before opening the final results; ties favor the |
| 68 | smaller change. Preserve every result, including failures. Do not expand the search |
| 69 | after seeing final scores. |
| 70 | |
| 71 | Reproduce the published baseline score before searching. Check CPU/GPU agreement |
| 72 | on a baseline window and a selected-candidate window. Evaluate the selected model |
| 73 | and baseline on the complete final set, sixteen paired contiguous blocks, and the |
| 74 | original published evaluation set. Prefer at least 0.1% lower final loss and allow |
| 75 | at most 0.2% regression on the original evaluation set. If those conditions fail, |
| 76 | retain the original as the recommended checkpoint. Compare fixed-prompt samples, |
| 77 | but do not treat an anecdotal sample as a general language-quality benchmark. |
| 78 | |
| 79 | ## Separate sibling-blend experiment |
| 80 | |
| 81 | The first search selected alpha 0.95, gain 1.00. Its fresh final loss was |
| 82 | 1.210277 against 1.210473 for the baseline, a marginal change below the stated |
| 83 | 0.1% preference. Its remaining paired-block checks were still running when the |
| 84 | second experiment was specified. |
| 85 | |
| 86 | The second and final search compares the unmodified BF16 model with blends |
| 87 | containing 90%, 75%, or 50% BF16 weights and the remainder from the full-length |
| 88 | rung-8 f32 model. Those runs shared initialization and training schedule, but are |
| 89 | distinct numerical trajectories. The editor's lower alpha bound is widened from |
| 90 | 800 to 500 for this experiment; its arithmetic is unchanged. |
| 91 | |
| 92 | Use different reserve stories, starting after source story index 20000, excluding |
| 93 | all normalized first-round calibration and final stories as well as training and |
| 94 | published evaluation text. Again select on 2,048 calibration stories and lock one |
| 95 | choice before evaluating the 4,096 final stories. Require at least 0.1% lower final |
| 96 | loss for a substantive upgrade and at most 0.2% regression on the published set. |
| 97 | No further search follows these final scores. Keep both experiments' receipts. |
| 98 | |
| 99 | The completed first search found only a 0.016192% fresh final-loss reduction; the |
| 100 | second search rejected every BF16/f32 blend on calibration and selected the unchanged |
| 101 | baseline. Retain the original training checkpoint. The small-gain copy is an optional |
| 102 | inference experiment. Numerical records and limitations are in |
| 103 | aien-train `evidence/OMEGALLM/weight-edit-20261104/README.md` (upstream, not in omega-mv). |
| 104 | No installed skill, existing build command, or production model route is changed. |