mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1345] [CLOSED] calibrate: the sweep visits every value in every round instead of once #3400
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3400
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1345
Author: @aly8246
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:calibrate-interleaved-sweep📝 Commits (2)
719ebb3calibrate: the sweep visits every value in every round instead of onceaac971csweep: the round line prints that round's draw, not the median through it📊 Changes
1 file changed (+32 additions, -12 deletions)
View changed files
📝
tools/calibrate.py(+32 -12)📄 Description
What this fixes
Phase 1 measures each PCIe share once and takes the maximum. A
rate()is a median of three 128-token generations, but all three run at the same setting in one block, so the whole measurement sits in one piece of the machine's state, and adjacent values cannot be ordered that way. From the sweep in #1332, on the same box:pcie_frac0.2% apart, while those same settings moved 8-28% between engine starts. @enkynakamura reports the same drift from the other side: +9.57 tok/s between two blocks at an unchanged setting on a 5080/Xeon box (p = 0.00004), larger than the effect being hunted. His interleaved run shows what it costs at the low end: 0.27 through 0.40 sit inside each other's noise (sd 2.3-2.7 tok/s) while 0.20 and 0.50 resolve cleanly against 0.33 (p = 0.0039 and p = 0.0005).
The consequence is not only a noisy number. Phase 1's winner is the share phase 2 then sweeps
spec_min_pat, and the confirm step puts only that one resulting pair against the default, so a value that was worth a real gain can lose its single sample and never be measured again. Widening the grid, as #1332 does, widens that exposure, which is why this should land with it or before it.What it does
sweep()measures every valueSWEEP_ROUNDStimes (3 by default) inside the one engine start, one round visiting every value and every other round in reverse order, and the winner comes from the medians:Drift inside a sweep then lands on every value the same number of times, the median keeps one bad sample from deciding, and the per-value range is printed so a user can see whether the winner is real. Phase 2 uses the same function, and the confirm step uses the same round count instead of a hard-coded three.
Cost
The sweep multiplies by
SWEEP_ROUNDS. Arate()is three prompts ofMAX_NEW128 tokens, so at 95-100 tok/s and six values phase 1 goes from about 40 s to about 120 s, on a run that already loads the model more than once. It is a module constant, and a machine whose two leaders stay inside each other's noise can raise it.Not in this change
Phase 4 measures the CPU worker count, which needs a restart per value and cannot be interleaved, so each count is still one measurement. A value there would need a different shape.
Tests:
python -m unittest tools.test_calibratepasses unchanged, because the stand-in engine is a pure function of the tune keys and the median of identical samples is that sample.tools.test_setup_configandtools.test_setup_goldenpass as well.Refs #1332, #1337.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.