Add an explicit native representation for sampled tokenization - #976
Closed
bradhilton wants to merge 2 commits into
Closed
bradhilton wants to merge 2 commits into
bradhilton wants to merge 2 commits into
Conversation
bradhilton
force-pushed
the
hayek/native-sampled-representation-20260926
branch
from
September 25, 2026 18:06
dc09f17 to
3c28a3f
Compare
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.
Recorded tool-call completions can make template-based tokenization fail even when the original prompts and output tokens are complete. This adds
representation="native"toart.tokenize_sampled(...), letting callers build histories directly from the recorded evidence.Native mode verifies complete conditioning, token IDs, logprobs, source order and STOP flags. It joins compatible consecutive generations and keeps others separate.
representation="rendered"remains the default, and genericart.tokenizeis unchanged. This PR depends on #973.Public regressions and full CI pass. Independent Astra and Fable source reviews found no blockers. One bounded invocation on a retained failure input also passed all 30 sources’ token, logprob, STOP and ownership checks on the current head.
This opt-in representation supports the SAMPLED first-occurrence loss contract. It does not establish numerical-training equivalence or interchangeable behavior for OUTPUT/SFT losses or arbitrary per-history weighting.
Validation details
PASS_WITH_NOTESfor head3c28a3fe9; a separate changed-source peer also passed.