feat(v1): carry paired routing weights in single-turn traces - #2568
Draft
faresobeid wants to merge 1 commit into
Draft
feat(v1): carry paired routing weights in single-turn traces#2568faresobeid wants to merge 1 commit into
faresobeid wants to merge 1 commit into
Conversation
Carry immutable expert IDs, FP32 coefficients and captured-row validity through single-turn training traces. Validate full payloads before graph mutation and reject unsupported continuation/fork cases without changing IDs-only replay. Assisted-by: Prime Agent
This was referenced Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the verifier transport and trace layer for Total Router Recall (TRR): immutable paired expert IDs and captured FP32 coefficients, with token-row validity. Keep IDs-only routing supported.
Validation
Current-main CPU validation, using the prepared renderer companion source:
uv run pytest tests/v1/test_graph.py tests/v1/test_trace.py -o addopts= -q: 37 passed.git diff --check, anduv run pre-commit run --all-files: passed.A broader local-only contributor run was attempted before the final test fix: 79 passed, 15 failed, 1 collection error. Eleven failures and the collection error require omitted example/optional task packages. Four failures came from a new test fixture that dropped the transient routing field; the focused rerun above confirms its fix. The full suite is not claimed as passing.
The original audited implementation reported 111 verifier routing/graph/trace passes. That is prior evidence, not a result from this rebased branch. No live provider, sandbox, GPU, training, throughput, or numerical-equivalence result is claimed. Model expert-count validation remains the trainer loader's responsibility.
Companions
Related #2544 backfills IDs-only turn boundaries; #2408 handles opaque ID decoding. Neither adds coefficient transport or full-coefficient replay.
AI assistance
AI agents assisted with implementation, review, tests, and preparation of this draft.
Note
Add
RoutingDatacarrier for paired routing weights in single-turn tracesRoutingDatadataclass in routing.py carrying FP32 weights, expert IDs, and per-row validity, with wire encode/decode and model-dependent validation._commit_turnto decode and validate full routing captures before mutation: rejects malformed coverage, unsupported reused-prefix/delta captures, and invalid message-span metadata; valid P+C-1 captures receive a synthetic invalid terminal row.MessageNode.routed_expertsandBranch.routed_expertsto accept either legacy ID arrays orRoutingData, enforcing single-sampled-node replay and sampled-terminal semantics for full mode while preserving legacy None behavior.RoutingDatafrom verifiers/v1/init.py and adds weight typing to types.py._commit_turnnow rejects reused-prefix continuations when existing prefix nodes already carry full routing and rejects mixed full/legacy routing evidence inconcatenate_routing; callers passing legacy ID arrays must still use supported uint8/uint16 dtypes.Macroscope summarized 036c828.