Avoid repeated numeric-list scans during trajectory serialization - #990
Draft
bradhilton wants to merge 1 commit into
Draft
bradhilton wants to merge 1 commit into
bradhilton wants to merge 1 commit into
Conversation
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.
Trajectory string interning checked whether a list contained only numeric values before consulting its graph memo, then returned without recording the list. Shared token/logprob-like vectors were therefore scanned repeatedly through each alias. Consult the existing per-traversal memo first and record numeric lists without copying or changing their values.
Validation:
cloudpickle.dumpsof public synthetic trajectory-group callbacks produces byte-identical baseline/candidate payloads across five alternating repetitions. The alias-heavy case falls from 0.4518 s to 0.0080 s median CPU time (56.48×); independent equal vectors show no regression (0.4798 s to 0.4679 s). These are synthetic results; live alias frequency and end-to-end preparation gains are unmeasured.git diff --checkpass. Independent source review passed.The memo remains local to one traversal. No new API, global cache, tokenization behavior, or active-run source adoption.