perf(buckets): add compilation buckets below 256 tokens - #706
Open
teerthsharma wants to merge 1 commit into
Open
perf(buckets): add compilation buckets below 256 tokens#706teerthsharma wants to merge 1 commit into
teerthsharma wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
teerthsharma
force-pushed
the
perf/add-small-compilation-buckets
branch
from
July 30, 2026 01:22
e3211ef to
47b2820
Compare
The default bucket list starts at 256, so every input with fewer tokens is padded up to 256. Trunk cost grows faster than linearly in the padded token count, so a 100-token input does several times the work it needs to. Adds 64, 96, 128, 192 and 384. All thirteen existing bucket sizes are retained, so no input is padded more than it is today. A bucket only triggers a compilation when an input actually falls into it, so the added sizes cost nothing for workloads that never use them. Signed-off-by: teerthsharma <teerths57@gmail.com>
teerthsharma
force-pushed
the
perf/add-small-compilation-buckets
branch
from
July 30, 2026 01:31
47b2820 to
1db8499
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.
Summary
_BUCKETSstarts at 256, so every input below 256 tokens is padded up to 256 before the trunk runs. This adds64, 96, 128, 192, 384. All thirteen existing sizes are retained, so nothing is padded more than today.No change to model code, config, outputs, or
--bucketssemantics.Padding cost
Ratios use a whole-model operation count derived from the op shapes in
modules.py,evoformer.py,diffusion_head.py,confidence_head.py:F(N) = 976896*N^3 + 1433624448*N^2 + 585859918336*N.Worst case over 64..5120: 5.97x → 2.15x. Mean, log-uniform: 1.45x → 1.32x.
Validation
Against the committed branch:
pipeline.py:53requires; all 13 previous sizes present.python -m py_compile run_alphafold.pypasses.Limits
Operation counts, not wall-clock; at small N inference is closer to launch-bound, so the realised gain is smaller. Not exercised end to end — the model parameters are access-gated and were unavailable, so the checks above are static ones on the bucket list and padding arithmetic. Benefit is confined to inputs below ~400 tokens. Each added bucket costs one compilation the first time an input falls into it; workloads that never run small inputs are unaffected.
AI disclosure
Per
CONTRIBUTING.md: AI (Claude) was used for the analysis and for this description. Topology and geometric methods are my area of specialisation, and the padding arithmetic and bucket reasoning here sit in that area. The operation counts are reproducible from the formula and bucket list above. No inference run was performed, so nothing here is a manually tested result.