aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / tools / omegallm / wgate / README.md
| 1 | # wgate |
| 2 | |
| 3 | `wgate.om` runs the round40 retention gates for DRA-187 (lane wsp) in seeded Omega. It replaces the Python |
| 4 | glue `evidence/OMEGALLM/wsp-dra187-20261107/gates.py`, which imported round41 `lib.py`, `repair.py`, |
| 5 | `checker.py` and `check_behavior.py`. |
| 6 | |
| 7 | ## Scope |
| 8 | |
| 9 | wgate covers only the 7 retention and latency gates of PREREG section 7: latency, copies, screen, |
| 10 | dev_jobs, regression, story_w256 and retention. |
| 11 | |
| 12 | Numerical validity (every weight finite, |w| <= 1e6, f32 against f64 agreement) and the byte-identical |
| 13 | revert are separate checks. They belong to wprobe and wpatch. wgate does not cover them. |
| 14 | |
| 15 | wgate reproduces the gates.py verdicts only on the inputs it reads. Any other input shape (non-ASCII |
| 16 | model text, JSON shapes the round40 files do not use, nesting past the Python recursion limit) is |
| 17 | refused with a nonzero exit. It does not guess. |
| 18 | |
| 19 | ## Build |
| 20 | |
| 21 | wgate is composed after `tools/omegallm/wdrive/wbuild.om`. That file supplies the path, argv, stdout, |
| 22 | environment and sha256 helpers (`wd*`), and its `main` is renamed `wbmain`. Build from the worktree root |
| 23 | with the pinned compiler (omega-mv e5b32567, omc sha256 |
| 24 | 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f): |
| 25 | |
| 26 | OMC=$HOME/work/wsp/omega-mv/seed/out/omc CORE=0 taskset -c 0 \ |
| 27 | wbuild OUT/wgate tools/omegallm/wdrive/wbuild.om@wbmain tools/omegallm/wgate/wgate.om |
| 28 | |
| 29 | `wbuild` is the wdrive bootstrap binary. It prints `BUILD_OK <binary sha256> ... source_sha256 ...`. |
| 30 | |
| 31 | ## Commands |
| 32 | |
| 33 | wgate run CANDIDATE.ck OUTDIR |
| 34 | wgate replay probe|first|jobs DATA.json RECORDED.json OUTDIR [STRIDE] |
| 35 | wgate replaylog probe|first|jobs DATA.json RECORDED.json LOGDIR LABEL OUTDIR [STRIDE] |
| 36 | wgate dryrun probe|jobs CK OUTDIR LABEL DATA.json |
| 37 | |
| 38 | - `run` is the gates.py main loop. It refuses with exit 3 before creating anything when SPARK_WINDOW is |
| 39 | missing or empty. |
| 40 | - It checks the base checkpoint sha256 and samples on the GPU binary. |
| 41 | - It writes `OUTDIR/gates.txt` (candidate, candidate_sha256, start, window, aux, then |
| 42 | `gate NAME VALUE PASS|FAIL WINDOW UTC` and `end UTC VERDICT`) and `OUTDIR/commands.txt`. |
| 43 | - A rerun on the same OUTDIR resumes. It skips gates already decided and stops at the first failed |
| 44 | gate. |
| 45 | - The last line is exactly `GATES_PASS` or `GATES_NOT_ALL_PASS`. |
| 46 | - `replay` scores recorded model answers without sampling and compares every row with the recorded |
| 47 | file. |
| 48 | - Kinds: `probe` is checker.check_answer probes, `first` is repair.check_answer (the screen gate), and |
| 49 | `jobs` is the multi-turn tool jobs of check_behavior. |
| 50 | - `STRIDE` selects every Nth data row, as `probes(..., stride)`. |
| 51 | - Output lines: `MISMATCH row=R [turn=T] field=F`, then |
| 52 | `REPLAY mode=KIND rows=N pass=P recorded_pass=Q mismatches=M`. |
| 53 | - Per-row results go to `OUTDIR/results/replay.txt`. |
| 54 | - `replaylog` does the same from a batch-sample log directory instead of the recorded raw outputs. |
| 55 | - `dryrun` prints the encode, sample and geval argv that `run` would execute, plus the batch-0 bytes and |
| 56 | sha256. It executes nothing and writes nothing (`NOT_RUN`). |
| 57 | |
| 58 | Relative paths are resolved lexically against `PWD` (exit 2 when PWD is absent). Symlinks are not |
| 59 | resolved. |
| 60 | |
| 61 | ## Exit codes |
| 62 | |
| 63 | | Code | Meaning | |
| 64 | |---|---| |
| 65 | | 0 | run: every task finished or stopped at a failed gate; replay: no mismatch | |
| 66 | | 1 | replay mismatch | |
| 67 | | 2 | usage | |
| 68 | | 3 | refused: no SPARK_WINDOW | |
| 69 | | 4 | base checkpoint sha256 mismatch | |
| 70 | | 5 | OUTDIR belongs to another candidate | |
| 71 | | 10 | window budget reached | |
| 72 | | 61 | arena or table full | |
| 73 | | 70 | host failure | |
| 74 | | 71 | file operation failed | |
| 75 | | 72 | text decode or encode error (non-ASCII model text) | |
| 76 | | 73 | native command exit status not 0 | |
| 77 | | 74 | native command timeout | |
| 78 | | 75 | sampler answer count mismatch | |
| 79 | | 76 | compile or test timeout inside compile_test | |
| 80 | | 77 | JSON nesting past the Python recursion limit | |
| 81 | | 78 | geval output unparsable | |
| 82 | | 79 | unsupported JSON shape | |
| 83 | | 80 | data or recorded file is not JSON | |
| 84 | | 81 | no recorded answer for a turn | |
| 85 | |
| 86 | ## Replay evidence (MEASURED, 2026-11-07, core 0, binary sha256 edbb7ae16db47ab9ca9febdec8e0b4a2c7fd678f24921a2a15896e64f1ed8a6b) |
| 87 | |
| 88 | R40 = `~/handoffs/tool-omega-20261104/round40`, R41 = `~/handoffs/tool-omega-20261104/round41`. |
| 89 | |
| 90 | | Check | Data | Recorded | rows | pass | recorded | mismatches | |
| 91 | |---|---|---|---|---|---|---| |
| 92 | | screen gate | R40/data/localization-screen.json | R41/blend/results/blend-s1000-a250-action-screen.json | 8 | 8 | 8 | 0 PASS | |
| 93 | | screen gate | same | blend-s1000-a500-action-screen.json | 8 | 7 | 7 | 0 PASS | |
| 94 | | screen gate | same | blend-s2000-a250-action-screen.json | 8 | 8 | 8 | 0 PASS | |
| 95 | | screen gate | same | blend-s2000-a500-action-screen.json | 8 | 7 | 7 | 0 PASS | |
| 96 | | regression | R40/data/regression.json | R40/step600-regression.json | 685 | 685 | 685 | 0 PASS | |
| 97 | | copies | R40/data/copy-final.json | R40/step600-copy.json | 64 | 64 | 64 | 0 PASS | |
| 98 | | regression-screen checker (STRIDE 10) | R40/data/regression.json | R40/step600-screen.json | 69 | 69 | 69 | 0 PASS | |
| 99 | | dev_jobs | R40/data/dev-jobs.json | R40/step600-dev-jobs.json | 84 | 84 | 84 | 0 PASS | |
| 100 | | retention | R40/data/retention-jobs.json | R40/step600-retention-jobs.json | 847 | 847 | 847 | 0 PASS | |
| 101 | |
| 102 | `step600-screen.json` is the regression-screen checker (regression.json at stride 10). It is not the screen |
| 103 | gate. The screen gate is localization-screen.json scored with repair.check_answer. |
| 104 | |
| 105 | Negative controls (all exit 1): |
| 106 | - screen row 0 raw_output set to `garbage` gives `MISMATCH row=0 field=pass` and pass 7 of recorded 8. |
| 107 | - regression row 3 raw_output set to `garbage` gives 3 mismatches (pass, compile_rc, run_rc). |
| 108 | - dev_jobs row 5 recorded pass set to false gives `MISMATCH row=5 turn=0 field=pass`. |
| 109 | |
| 110 | `env -u SPARK_WINDOW wgate run X OUT` exits 3 and creates nothing. |
| 111 | |
| 112 | NOT_RUN: live sampling, GPU geval scoring and latency timing (the `run` path). They need a GPU window. |
| 113 | |
| 114 | ## ORACLE |
| 115 | |
| 116 | `jq` is used only as an ORACLE, outside wgate. It built the negative-control copies (one field changed) |
| 117 | and it reads `round41/commands.jsonl` to compare the dry-run argv with the recorded round41 argv. wgate |
| 118 | itself has no jq, Python, shell or C dependency. |
| 119 | |
| 120 | ## Known differences and risks |
| 121 | |
| 122 | - Results are plain text (`results/LABEL.txt`), not the JSON that gates.py wrote. |
| 123 | - gates.py never created `OUT/build`. wgate creates it. |
| 124 | - Children run with an empty environment and inherit open descriptors. Process polling has 200 us |
| 125 | latency. |
| 126 | - Python exceptions in the original are mirrored as the nonzero exits above, not as tracebacks. |
| 127 | - Loops are bounded by omc limits (at most 999999 per loop level). Arena 16 MiB, JSON nodes 2097152. |
| 128 | - wgate depends on the in-progress wdrive library `wbuild.om`. |