Split divergent token histories by default - #782
Merged
Conversation
bradhilton
force-pushed
the
agent/reconcile-tokenizations
branch
from
July 29, 2026 00:47
bf680b8 to
627f0f3
Compare
bradhilton
marked this pull request as ready for review
July 29, 2026 02:12
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
Make protocol-native trajectory histories preserve divergent served token identities by default instead of automatically reconciling text-equivalent prefixes.
reconcile_text_equivalent_tokenizations=Trueas an explicit opt-in on history projection,Trajectory.tokenize(), andTrajectoryGroup.tokenize()SAMPLEDprovenance, and rollout logprobs when an unchanged generated suffix appears in a later split historyTokenFlag.EXACTtokensWhy
Rendered text can remain identical while its token IDs differ from the sequence originally sampled by the policy. Treating those turns as one history silently changes the RL sequence. The safe default is now to expose separate histories; callers may explicitly opt into best-effort text-equivalent reconciliation.
Splitting must not discard valid rollout evidence. When a later exact prompt proves that an earlier sampled output is retained, that output keeps its original token IDs, logprobs,
EXACT, andSAMPLEDflags in the descendant history.The preprocessing path fails closed when exchange tokenization required local rendering, matching its strict tokens-in/tokens-out requirement.
Validation
ty,prek, and lock consistency: passedThe full GitHub quality, package-install, and TrainerRank classification checks will rerun against the updated head.