Skip to content

Preserve native token boundaries during trajectory replay - #924

Merged
bradhilton merged 3 commits into
mainfrom
neumann/056-canonical-tool-tail
Sep 17, 2026
Merged

bradhilton merged 3 commits into
mainfrom
neumann/056-canonical-tool-tail

Conversation

@bradhilton

@bradhilton bradhilton commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Exact replay exposed a rerendering bug: replacing a complete native tool response left rendered closing markup behind. Later histories then acquired different prefixes and counted canonical action tokens twice. Extend complete sampled responses through the renderer-proven assistant stop, bounded to the current message. Adjacent assistant messages can share a role mask; a matching completed-message render now proves the boundary before expansion. Preserve additional served whitespace before a truncated response's proven stop tail without accepting changed stop tokens or other inserted text.

Validation

  • 566 trajectory tests passed. Regressions cover closing tool markup, boundary whitespace, rejection of inserted text, and adjacent assistant messages with an EOS token inside reasoning. Both adjacent-message cases fail on the previous PR head and pass after the fix.
  • 160 saved Qwen 3.6 training captures preserve canonical counts, native sampled IDs/logprobs, and every served causal prefix. Tokens, logprobs, flags, and training masks are identical to the previously GPU-qualified ART 33467475 revision. The formerly failing capture selects exactly 7,418 canonical tokens instead of 12,063.
  • All 64 saved generated-validation captures have identical tokenization and probe masks through experiment 056's actual world-trace projection. Direct tokenization of two unprojected dynamics histories fails on both revisions; those raw histories are not inputs to the experiment's probe. This auxiliary limitation remains unresolved and is recorded in the review packet.
  • ART CI on 3e201039f passes: 785 Megatron tests; 1,629 unit tests passed, 73 skipped, 2 deselected by the existing workflow; lint, format, type, and lock checks passed.
  • The earlier 2×H200/default-CP smoke on ART 33467475 passes both Adam updates, publication, checkpoint verification (124 files; all 41,460 optimizer states at step 2), and final validation on 32 fresh generations. The review fix at 3e201039f has regression and saved-input equivalence checks; no new GPU run was launched. GPU qualification uses deployed Caladan protocol 7 and does not qualify protocol-8 migration.

Related Caladan #441. Qualification report. Local review packet: /home/brad/.local/share/neumann/056-smoke-20260916/HAYEK_REVIEW.md.

@bradhilton
bradhilton marked this pull request as ready for review September 17, 2026 03:53

@bradhilton bradhilton left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review text removed on 2026-09-17; the consolidated review record is in the summary comment on this PR.

@bradhilton bradhilton left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review text removed on 2026-09-17; the consolidated review record is in the summary comment on this PR.

@bradhilton
bradhilton merged commit 44bc5d4 into main Sep 17, 2026
7 checks passed
@bradhilton

Copy link
Copy Markdown
Collaborator Author

Consolidated review record (automated agent review traffic removed 2026-09-17)

Change. Exact replay left rendered closing tool markup behind, so later histories gained different prefixes and double-counted canonical action tokens. Complete sampled responses now extend through the renderer-proven stop within the current message; truncated responses keep served boundary whitespace but reject inserted text.

Review. Minsky and McCarthy reviewed pre-fix head 3346747. Minsky: CLEAR on source correctness (259 tokenize cases and 75 trajectory tests passing, base failing only the two new cases, ruff and ty clean). McCarthy requested changes, resolved at merged head 3e20103 (no agent verdict posted); CI there passed 785 Megatron and 1,629 unit tests plus lint, format, type and lock checks.

Findings addressed during review.

  • The tail extension could cross into an adjacent assistant message sharing one mask run (span-overlap error); a matching completed-message render now proves the boundary first.

Deferred / follow-ups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant