Preserve forked native conditioning in multi-history tokenization - #983
Draft
bradhilton wants to merge 6 commits into
Draft
bradhilton wants to merge 6 commits into
bradhilton wants to merge 6 commits into
Conversation
bradhilton
marked this pull request as draft
September 26, 2026 15:46
This branch has not been deployed
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.
Complete recorded exchanges can still fail tokenization when a later request retains or canonicalizes an earlier response and its native prompt is no longer an extension of that response's full prompt/output sequence. This change lets the existing
multi_history=Trueand internal exchange-training paths emit adjacent native streams, each preserving the original conditioned tokens, logprobs and sampled ownership. Single-history APIs continue to refuse incompatible linear representations; no new option is introduced.Stacked on #977. Ordinary native successes remain first. Splitting requires complete unchanged Chat provenance, exact canonical request scopes, full native source-span occupancy and STOP proof. Request-context roles retain the existing rendering proof. Final callback-free snapshots prevent a later renderer or STOP encoder from changing already-certified source/context evidence. Explicit render overrides and incomplete/edited authority do not authorize splitting.
Validation:
Canonical CI passes at
d1bb8e90e: 1,264 lightweight tests and 2,330 unit tests, plus lint, formatting, types and lockfile checks. Independent source and retained-result reviews passed; the test-only warning-isolation and nonzero-gradient follow-ups also have affected reviews.Public regressions independently compare first ownership before finite filtering, including NaN/overflow-first duplicates; they exercise nonzero trajectory advantages, shared weights, causal packing, copied context, strict refusals and callback mutation. Actual ART CISPO/PPO losses and gradients of a tiny shared-parameter CPU predictor match an independent original-completion analytic oracle, including clipped and active contributions of both advantage signs and physical prefix sharing.
One bounded offline comparison of the retained batch208 trajectory: unchanged Reuse recorded tokens by default and preserve literal assistant content #977 refuses; this change preserves all 31 source encounters/30 unique sources in three histories, with 4,139 first-owned finite loss terms and 29 sampled STOPs. Public process-worker and internal preprocessing arrays agree; original input/options remain unchanged. Both single-linear APIs still refuse. The captured oracle independently derives inventory and first ownership while sharing unchanged STOP/source-key primitives. No model, provider or GPU run was performed.
The exact production tokenizer in this PR (
92311689) was reapplied as a one-file patch to the selected current ART main80015faereceiving tree. All 60 affected receiving cases pass. A new bounded offline replay again verifies the previously refused batch208 input (31 encounters / 30 sources, 4,139 finite selected terms and 29 sampled STOPs), while a previously successful real trajectory spanning stop, length and tool-call responses preserves its entire result and all four ownership masks exactly. Original inputs, options and source bindings remain unchanged; both local process families are closed. This is CPU token/objective coverage, not a native optimizer-update or fresh learning claim.The captured normalization check uses a constructed one-trajectory group, whose centered advantage is zero; it is not original-group gradient equivalence. The separate public gradient regression is not transformer-weight or GPU numerical equivalence. Earlier responses outside a run become that request's context, so this does not claim universal
OUTPUT/SFT layout parity with every formerly successful rendered-copy path. Extra streams can repeat context; no speed or GPU-memory claim is made. Current experiments and frozen pins are unchanged.