feat(calib): global cross-layer MP budget + offline rebucketing - #4
Open
heroarmor wants to merge 1 commit into
Open
feat(calib): global cross-layer MP budget + offline rebucketing#4heroarmor wants to merge 1 commit into
heroarmor wants to merge 1 commit into
Conversation
Add a GLOBAL budget scope to the MP threshold calibrator alongside the
existing per-bucket mode, plus tooling to re-derive tables offline.
calibrate_mp_thresholds.py:
- --budget_scope {per_bucket,global}: per_bucket (default, unchanged) pins
each (op, t-bucket, l-bucket) group to budget_ratio*ref; global solves one
shared Lagrange multiplier over all groups so the budget flows across
layers/operators (port of CrucibleComputingGroup/scmp_llm PR#9 act_global).
- R_g-weighting: rep_g = R_g/n_g prices each stored (subsampled) row by its
true per-forward row count, so the per-row assignment and the row-weighted
budget share one objective -> uniform stays feasible and the optimum is
provably <= uniform. Reports expected_avg_stoc_len as an honest iso-budget
check.
- --dump_raw: pickle the full-resolution per-(operator,block,timestep) error
log so any (timestep_buckets, layer_buckets) can be re-fit offline.
- --max_units_per_call now defaults to 0 (no subsampling) so stored counts
equal true rows and the subsampling asymmetry (av uncapped vs linears
capped) no longer distorts the global allocation.
rebucket_from_raw.py: re-derive a calib table at any bucketing from a raw
dump with no GPU and no re-probing; fitting logic copied verbatim so the
output is bit-for-bit identical to a fresh probe.
_mp_calib_worker.sh: add --sc_qk_granularity per_row.
scripts/: 6-GPU FID/KID generation runners for the global / globalpr /
pbperrow / fullT calib variants, the FP 6-shard reference, and a 3-GPU
parallel stoc runner.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 4, 2026
heroarmor
pushed a commit
that referenced
this pull request
Aug 18, 2026
feat(sc): uSystolic stoc_len halving + per-row QK granularity
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.
Stacked on #3 (
feat/sc-eval-runners-calibfix). Adds a global cross-layer budget scope to the MP threshold calibrator and the tooling to re-derive tables offline.What
--budget_scope {per_bucket,global}incalibrate_mp_thresholds.pyper_bucket(default, unchanged): each(op, t-bucket, l-bucket)group pinned tobudget_ratio*ref.global: one shared Lagrange multiplier (_global_lambda) over all groups, so the budget flows across layers/operators instead of being pinned per bucket. Port ofCrucibleComputingGroup/scmp_llmPR#9'sact_globalallocation.rep_g = R_g/n_gprices each stored (subsampled) row by its true per-forward row countR_g, so the per-row assignment and the row-weighted budget share one consistent objective → uniform stays feasible and the optimum is provably ≤ uniform. Without it, attention (qk/av) — far more rows per forward than the linears — is under-counted and global overspends (avg_sl ≫ target).expected_avg_stoc_lenreported as an honest iso-budget check (row-weighted realized average).--dump_raw: pickle the full-resolution per-(operator, block, timestep)error log so any(timestep_buckets, layer_buckets)can be re-fit offline.--max_units_per_callnow defaults to0(no subsampling) → stored counts equal true rows, removing the av-uncapped-vs-linears-capped asymmetry that distorted the global allocation.New files
scripts/rebucket_from_raw.py— re-derive a calib table at any bucketing from a--dump_rawpickle, no GPU / no re-probing. Fitting logic copied verbatim from the calibrator so output is bit-for-bit identical to a fresh probe.scripts/sbatch_mp_avg64_{global,globalpr,pbperrow,fullT}_6gpu.sb— 6-GPU FID/KID generation runners for each calib variant.scripts/sbatch_fp_6shard_cfg15.sb,scripts/sbatch_mp_avg.sb,scripts/run_3gpu_parallel_stoc.sh— FP reference / generic mp_avg / 3-GPU parallel runners.Other
_mp_calib_worker.sh: add--sc_qk_granularity per_row.Notes
per_bucketpath is the default and bit-for-bit unchanged;globalis opt-in.tools/(compare_old_vs_new*,sc_call_counter*,smoke_test_e2e) are intentionally excluded from this PR.py_compileandbash -npass on all touched files.🤖 Generated with Claude Code