Repository navigation
moe: the engine reads a moe_placement table only if it was written for this model (Refs #1702) - #2156
Conversation
…r this model (Refs #1702) app/moe_placement.h is the reader the #1702 decision named as the open task: schema, group count, every routed layer, every expert id exactly once, and the held-out share against a floor (15 %, never the in-sample share). ctest moe_placement_reader: one adopted table and one arm per refusal. Co-authored-by: bong-water-water-bong <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
ready for review at 6910a41 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 6910a41: READY
Reviewed head 6910a41 (refs #1702). This is the first verdict.
Checked
git merge-treeonto main: no conflicts.- ctest
moe_placement_readerandmoe_placementpass, built from this head.moe_placement_testis a build dependency ofonebit, so CI actually runs it: the CI log at this head has#85: moe_placement_reader … Passed, 231/231. CIbuild,hrx_buildand CodeQL green. - Mutants of
app/moe_placement.h, on the checks the body's three mutants did not cover. Each was rebuilt and run:
| check removed | arm that fails |
|---|---|
schema (schema != kPlacementSchema) |
"another schema (adopted)" |
group count (p.groups != want.groups) |
"a table for 4 devices on a 2-device run (adopted)" |
| per-layer expert count | "built for another expert count (adopted)" |
| an unplaced expert | "an expert placed nowhere (adopted)" |
| a layer the model does not route | "a layer this model routes nowhere (adopted)" |
the upper id bound (id >= want.n_experts) |
refused, but by accident: see below |
I restored the file (git status clean); "moe_placement_test: ok".
One observation, not blocking. With the upper bound removed, id 8 on an 8-expert model indexes pl.group_of[8], one past the vector, and the arm passes only because that out-of-bounds read happened to look like "placed twice". So the range check (:149) is also the memory-safety check for the two group_of[size_t(id)] accesses after it. Worth a word in its comment, so nobody "simplifies" it into the expert-count check at :135. That one only runs when the layer carries an experts key.
Not re-run by me: the round trip through tools/moe_placement.py on a synthetic trace.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
…t prose (#1702) The reader (app/moe_placement.h, #2156) refuses a table written for another model, group count or expert count, and gates on the held-out share. It had only synthetic tables to read. This adds the writer's actual output for the Flash-Next decode trace -- 48 routed layers, 512 experts, 2 groups, in-sample share 0.523 against a 0.2% contiguous control, held out 0.1892 over 5280 steps, every layer a permutation of 0..511 -- so the issue's headline is reproduced through the shipped path rather than an analysis script. Registered as a second arm, moe_placement_reader_fixture, because main already registers moe_placement_reader without an argument. A second add_test with the same NAME is a CMake configure error ('given test NAME ... which already exists'), so the rebase had to give the arm its own name: verified with a two-line project that duplicates fail (rc=1) and these two names do not (rc=0, ctest lists both).
…t prose (#1702) (#2286) The reader (app/moe_placement.h, #2156) refuses a table written for another model, group count or expert count, and gates on the held-out share. It had only synthetic tables to read. This adds the writer's actual output for the Flash-Next decode trace -- 48 routed layers, 512 experts, 2 groups, in-sample share 0.523 against a 0.2% contiguous control, held out 0.1892 over 5280 steps, every layer a permutation of 0..511 -- so the issue's headline is reproduced through the shipped path rather than an analysis script. Registered as a second arm, moe_placement_reader_fixture, because main already registers moe_placement_reader without an argument. A second add_test with the same NAME is a CMake configure error ('given test NAME ... which already exists'), so the rebase had to give the arm its own name: verified with a two-line project that duplicates fail (rc=1) and these two names do not (rc=0, ctest lists both). Co-authored-by: bcloud <agent@local>
Refs #1702. This adds the reader that the issue's decision (11-11 01:12Z) named as the open task: "the splitter's reader for the table, gated as above." It does not add a splitter, and it does not add the NVMe write order; that order waits for the streamer, as the decision says.
What it does
app/moe_placement.h(header only) loads atools/moe_placement.pytable and checks it against what the caller is about to run. It returnsgroup_of(layer, expert), or an error naming the check that failed. Every refusal below catches a table that is plausible but wrong. A table built for another model still places every expert of its own model exactly once, so a reader without these checks would adopt it without complaint.schemaschema "something/else" is not "1bit/moe-placement/1"the table splits into 4 groups, this run has 2share_in_sampleno "share_held_out": the gate is the held-out share, not share_in_sample (51.1 %)share_held_out 7.0 % is under the gate 15.0 %layer 3 is missing from the table/layer 2 is not a routed layer of this modellayer 1: the table was built for 16 experts, this model has 8expert 8 is outside 0..7/expert 4 is placed twice/expert 5 is not placedThe 15 % floor is the decision's figure: "> ~15 % is the floor these traces support". A caller can change it through
min_held_out.Checked
ctest -R moe_placement: both rows pass.moe_placement_readerpasses 22/22 checks, and the tool's ownmoe_placementself-test still passes.tools/moe_placement.py trace.tsv -g 2 -e 16 -o placement.json, run on a synthetic two-layer trace, is adopted with{1, 3}, 16, 2. The same file is refused for a 32-expert model withlayer 1: the table was built for 16 experts, this model has 32.copyright.py --check,ci_targets_check,tests_referenced_checkandpython_test_order_checkall give rc 0.docs/moe-streaming.md, in the placement-table section.Nothing in the engine consumes the table yet, so this changes no served behaviour.
🤖 Generated with Claude Code