Skip to content

feat(calib): global cross-layer MP budget + offline rebucketing - #4

Open
heroarmor wants to merge 1 commit into
feat/sc-eval-runners-calibfixfrom
feat/mp-global-budget-rawdump
Open

feat(calib): global cross-layer MP budget + offline rebucketing#4
heroarmor wants to merge 1 commit into
feat/sc-eval-runners-calibfixfrom
feat/mp-global-budget-rawdump

Conversation

@heroarmor

Copy link
Copy Markdown
Owner

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} in calibrate_mp_thresholds.py
    • per_bucket (default, unchanged): each (op, t-bucket, l-bucket) group pinned to budget_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 of CrucibleComputingGroup/scmp_llm PR#9's act_global allocation.
  • R_g-weighting: rep_g = R_g/n_g prices each stored (subsampled) row by its true per-forward row count R_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_len reported 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_call now defaults to 0 (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_raw pickle, 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_bucket path is the default and bit-for-bit unchanged; global is opt-in.
  • Local diagnostic scripts under tools/ (compare_old_vs_new*, sc_call_counter*, smoke_test_e2e) are intentionally excluded from this PR.
  • py_compile and bash -n pass on all touched files.

🤖 Generated with Claude Code

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>
heroarmor pushed a commit that referenced this pull request Aug 18, 2026
feat(sc): uSystolic stoc_len halving + per-row QK granularity
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