Skip to content

Avoid redundant source graphs in process tokenization results - #1003

Closed
bradhilton wants to merge 7 commits into
mainfrom
hayek/tokenizer-ipc-source-refs-20260927
Closed

bradhilton wants to merge 7 commits into
mainfrom
hayek/tokenizer-ipc-source-refs-20260927

Conversation

@bradhilton

@bradhilton bradhilton commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Process tokenization sends the worker's trajectory and exchange graph back to a parent that already owns and rebinds those sources. This change uses private source references for eligible results, reducing redundant serialization while retaining ordinary pickle for unsupported graphs. There is no new public option.

Parent and worker eligibility checks cover reconstruction callbacks, instance attribute resolution, finalizers, concrete source-field roles, aliases and shared model state. Schema discovery reads only supported passive metadata and runs afresh for each transfer, so declaration changes between transfers cannot retain stale eligibility. Customized descriptors, containers or keys take the ordinary path without added callbacks. A private byte frame distinguishes optimized results before reconstruction, and the reader releases its source callback with the unpickler even on errors.

Parent and worker use the same internal codec version. Graphs, classes and registrations must remain stable during transfer; inspected framework/stdlib bases and normal generated enum state must be unmodified. The ordinary serializer includes merged #1011, #1012 and #1013 and is unchanged by this PR.

Validation at 5ddf81f859e940c9488e64dfc7195189b5def507: all 815 related cases have exact passing observations across finite executions. The initial parallel attempt had six existing 30-second process waits time out and two shard cutoffs; all eight cases subsequently passed unchanged in isolated executions. Those initial failures remain recorded, and their timing cause is unproved. Six new declaration-change and actual-spawn regressions fail semantically on the parent; twelve additional warm-alias cases establish conservative fallback, with twelve preserved controls. Formatting, lint, type checks and the 264-model schema check pass. Independent source receiving verifies parent/worker transitions and ordinary callback, alias and error behavior.

Held draft pending fresh cumulative model reviews, exact-head CI, focused frozen-provider receiving and current-source performance evidence. Historical d67 timings on constructed data do not measure this source. Earlier rejected or incomplete observations—including an unclassified prior 420-second attempt—remain retained. This draft has not been adopted by qualification runs.

Current source hold: real-spawn public cases show that narrowed parent declarations can differ from the worker declarations throughout an otherwise stable transfer. Parent preflight can omit a source-wrapper descriptor, allowing optimized decoding to suppress its callback or turn its error into success. Exact 5ddf81f8 is not ready for merge or adoption; source and historical evidence are retained unchanged.

@bradhilton
bradhilton force-pushed the hayek/tokenizer-ipc-source-refs-20260927 branch from a8b55d4 to 7624d05 Compare September 28, 2026 12:21
@bradhilton
bradhilton force-pushed the hayek/tokenizer-ipc-source-refs-20260927 branch from 7624d05 to df88edb Compare September 28, 2026 12:53
@bradhilton

Copy link
Copy Markdown
Collaborator Author

Closing this unmerged draft and retaining ordinary pickle for process-result transfer.

Current main at d22abdc already serializes the full result with pickle.dumps and restores it with pickle.loads followed by the existing source rebinding. This proposal's source-elision format and admission helpers are absent from maintained main, so no removal or no-op merge is needed. The merged recorded-conditioning implementation in #1014 remains intact.

The reproduced blockers are semantic:

  • A parent's model declarations can remain stable yet differ from a spawned worker's declarations. Elision can then skip a parent-side descriptor callback or its exception.
  • Rebinding copyreg.dispatch_table (even with an agreeing pickle.dispatch_table) does not replace the C pickler's retained dictionary. Checking those public names can miss an actual reducer and skip its callback or exception.
  • A subsequent attempt to verify the C dictionary through gc.get_referents introduced audit callbacks absent from ordinary pickle. An audit hook denying that event made the proposed parent transfer fail while ordinary transfer succeeded.

The latest isolated successor passed 842 controls, including the eight discriminators that failed on the preceding source, but the independent audit reproduction still invalidates it. All source versions, reproductions, review findings and bounded-run evidence are retained. The earlier constructed-case timing improvement is not evidence that a correct general implementation is ready, and is not a production performance claim.

Further transfer improvements should preserve the ordinary pickle route and its value, alias, callback and exception behavior. This generic elision design will not be merged.

@bradhilton bradhilton closed this Sep 28, 2026
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