Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/blob/main/docs/MERGE_TRAIN.md # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / docs / MERGE_TRAIN.md` 106 lines ยท 8397 bytes Raw Blame History Rendered 1 # The merge train 2 3 Drake, 2026-10-21: "batch the tests ... make this the standard for doing these from now on. Call it the merge train." 4 Ledger L384. Every lever on the 35B serving path is tested and merged on the train. No lever loads its own full-model 5 copy for its own gate. 6 7 One cycle is: **one candidate build** holding every READY lever, **one 35B load** (two at most, see load-only switches), 8 **one shared suite** run against **stored references**, and **one verdict per lever**. A failing lever is switched off and 9 the rest ride on. 10 11 Files: 12 13 | what | where | 14 |---|---| 15 | the command | `evidence/merge-train/merge-train` (bash + jq + curl) | 16 | the suite (data) | `evidence/merge-train/suite.json` | 17 | run folders, verdict tables | `evidence/merge-train/runs/-/` | 18 | the reference store | `~/.local/state/aien-q36/merge-train/refs///alone/`, `CURRENT` symlink | 19 | host goldens (no load needed) | `evidence/q36-host-`20261020`/gen-*.json` | 20 | per-request switches | cargo feature `aien-test-switches` in `crates/aien-serve-http` | 21 22 ## 1. Per-request switches (`aien_test`) 23 24 A test build (`cargo build --release -p aien-serve-http --features aien-test-switches`) reads an extra request field: 25 26 ```json 27 "aien_test": {"stroke": false, "exact_head": false, "mutant": 4, "row_swap": 2} 28 ``` 29 30 | switch | effect, this request only | default | 31 |---|---|---| 32 | `stroke` | `false`: this row steps on its own one-row graph, never in a stroke with other rows | `true` | 33 | `exact_head` | `false`: the plain one-pass head instead of the exact two-pass head | `true` | 34 | `mutant` | graph mutant `k` (the `AIEN_Q36_TEST_MUTANT` numbers) for this row's steps | `0` | 35 | `row_swap` | at this row's `k`-th step the scheduler trades rows with another decoding conversation (both go red) | off | 36 | `prefill_chunk`, `prefix_pool`, `state_bf16` | names reserved for L369, L375, L313; refused until their lever wires them | | 37 38 Honesty rules, enforced in code: 39 40 - A build **without** the feature (the live build) answers **400** to any request carrying `aien_test`. It can never serve a test case. 41 - A test build answers **400** for a switch its engine does not honor. `/health` lists the honored switches under `aien_test.honored`. 42 - Every reply that set switches echoes them in `usage.aien_test.applied`. The train records ERROR, never PASS, when the echo is missing. 43 - Rows without switches take the served path unchanged (the strokes, the exact head). A switched row steps alone that beat. The other rows' words are unchanged, and the suite checks that (`mutant-row-isolated`). 44 45 **Load-only switches** (a setting read once at start, such as `AIEN_OMEGA_GDN_STATE_BF16=1` or `AIEN_BOARD_DIR`) are a suite 46 *arm* with `server_env`. The train loads a second server for them after the first one stops, so a cycle loads twice at most. 47 An arm can name `log_proof`, a word the server log must show, so a build that ignored the setting is marked NOT-ON-TRAIN, not PASS. 48 49 ## 2. The suite format (`suite.json`) 50 51 The suite is data. A lever joins by adding JSON, not code. 52 53 - `arms`: named ways to run the suite. `aien_test` arms are request switches on the one server. `server_env` arms are a second server. `enabled: false` keeps an arm off until its lever is in the candidate. 54 - `levers`: `id`, `name`, `arms` (which arms test it), and `present` (how the train tells whether the lever is in this candidate at all): 55 `{"always": true}`, `{"switch": ""}` (in `/health` honored list), `{"health": ".path"}` (truthy in `/health`), `{"model": ""}` (a served model id), `{"build": ""}` (matches the bin's `BUILD.txt`). 56 - `cases`: each case has an `id`, a `kind`, and optional `arms` (default: every arm) and `levers` (default: every lever whose arms include the arm). 57 58 | kind | requests | PASS when | 59 |---|---|---| 60 | `golden` | one chat request (`user`, `max_tokens`) | token ids == the host golden's `generated_ids` | 61 | `together` | the first `n` prompts of `prompts.txt` at once, `stagger_ms` apart in groups of 8, `max_tokens` by `ntok(i)` | every reply == the same request alone (reference store) | 62 | `turn2` | the stored turn-2 messages | ids == the stored turn 2 | 63 | `tool` | one request with `tools` | the reply is a parsed tool call named `expect_tool` | 64 | `script` | the owner's own gate script, run against the train's server (`$PORT`, `$OUT`, `$SERVER_LOG` substituted in `args`) | the script exits 0 (1 FAIL, other: ERROR) | 65 66 Red controls (the proof that a comparison can fail): `"expect": "red"` on a `golden` case, or `expect_red` (row list), 67 `expect_red_min`, `others_red_max` on a `together` case with `aien_test_on` (`{"": {switches}}`). A red control that comes 68 back identical is **RED-FAIL** and fails every lever it covers. 69 70 ## 3. The reference store 71 72 References are the token ids of every suite prompt served **alone** (one request at a time) plus turn 2, computed **once** per 73 (model, reference build) and kept under `~/.local/state/aien-q36/merge-train/refs///alone/`. `CURRENT` points 74 at the one in use. No gate re-runs the reference side unless the reference build changes. 75 76 ``` 77 merge-train ref # compute from the reference build serving on 78 merge-train ref-import # import an existing gate's alone/ folder 79 merge-train ref-use # switch CURRENT 80 ``` 81 82 Goldens (`evidence/q36-host-`20261020`/`) come from the host reference model and need no load at all. 83 Today's reference: ``5b726818``, imported from L354's `evidence/q36-batch-`20261021`/alone/` (the single door, 02:42Z). 84 L354's batch gates on bin-`16b0e6f8` matched it 32/32. 85 86 ## 4. The cycle 87 88 1. **Join.** A lever owner pushes the lever branch, posts a READY line on `~/handoffs/BOARD.md`, and adds the lever's cases to `suite.json` by commit on `serve/merge-train` (or by ledger note on L384, and L384 adds them). A new switch goes in `TestSwitches` (`crates/aien-serve-http/src/engine.rs`) and in the engine's honored list, with a host test that the switch changes only its own row. 89 2. **Build.** L354 (the serving lane) merges every READY lever branch onto the ship branch with this branch, builds once with `--features aien-test-switches`, and pins `~/.local/state/aien-q36/bin-/` (binary, lib, `BUILD.txt` naming every lever branch and sha, `SHA256SUMS`). 90 3. **Run.** `merge-train run ~/.local/state/aien-q36/bin- --post`. The train loads the candidate under `q36-extra` (`Q36_EXTRA_LEDGER=L384`, port 18100 by default, never 18091), runs every request arm, stops the server, loads a second server only for enabled load-only arms, and writes `runs/-/verdict.md` (lever x case table, then every cell) and `receipt.json` (loads, load seconds, suite seconds). 91 4. **Post.** `--post` appends one BOARD line with every lever's verdict and adds a `ledger note` to each lever's item. 92 5. **Ship.** The live build is the same merge **without** the feature. It is built from the same commit and gated by the cells that passed. 93 94 ## 5. When a lever fails 95 96 - **FAIL or RED-FAIL** in a lever's row: the lever is dropped from this cycle. If the lever has a switch, its arm stays in the suite and the candidate ships with the switch's served default set to off (the lever's own env switch, such as `AIEN_Q36_STROKE=0`). If not, L354 rebuilds the candidate without that branch. The rest of the levers ride on, and the dropped lever's owner gets the cell folder in the ledger note. 97 - **ERROR** is not a verdict (no reply, a 400, a missing reference). Fix the cause and rerun. A lever is never merged on ERROR. 98 - **NOT-ON-TRAIN**: the lever or its switch is not in this candidate. That is not a failure. It just did not ride this cycle. 99 - A failure that touches the shared cases (goldens, `concurrent-32`, `turn2`) fails every lever on that arm. Bisect by arm first: if `plain` fails and `stroke-off` passes, the stroke lever is the suspect. 100 101 ## 6. Rules 102 103 - Extra 35B loads only through `~/.local/bin/q36-extra`. Never port 18091 (the live server), 18092 or 18095. 104 - The train's one server replaces each lever's own test copy. A lever owner does not load a copy for a gate the train covers. 105 - Owners keep their deep evidence (speed receipts, bit-identity at the model level) in their own `evidence/`. The train is the merge gate. 106 - bash + jq + curl only. No Python.