Skip to content

fix(paro): restore the accuracy-tuned optimizer batch default (#5306) - #5356

Merged
Qubitium merged 1 commit into
mainfrom
fix/5306-paro-batch-lr
Nov 19, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/5306-paro-batch-lr

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

#5279 raised ParoConfig.opt_batch_size from 64 to 128 for speed. Rows per epoch stayed the same, but the number of optimizer steps per epoch halved, so at a fixed LR the per-epoch update halved too. On Llama-3.2-1B-Instruct that gave back most of the accuracy #5175 had recovered (#5306).

This PR:

  1. scales the three stage LRs (rotation, weight, quantizer) from the 64-row reference, so an opt-in larger step still moves proportionally further per epoch;
  2. puts the default back on the accuracy-tuned 64 rows.

Why the default goes back to 64

Measured on this host (Llama-3.2-1B-Instruct, Paro 4-bit g128 fp16, 128 C4 docs, quantize → save → reload → wikitext-2 PPL, 80×512 windows):

config wikitext-2 PPL vs bs=64
bs=64, 1× LR (reference) 20.0401 —
bs=128, 1× LR 20.4726 +2.16%
bs=128, 2× LR (this PR's scaling) 20.1953 +0.77%
bs=128, 3× LR 20.1274 +0.44%
bs=128, 4× LR 20.3361 +1.48%

Scaling recovers most of the loss, and 3× is the best coefficient, but no coefficient closes the gap: at half the steps there are also half as many validation checkpoints, so the selected best state is coarser. That part is not an LR problem.

#5246's acceptance bar is accuracy ("PPL equal to or better than the post-#5175 values"), so the shipped default stays at 64. Users who want the 128-row speed can still opt in, and the LR scaling keeps them close.

flowchart LR
    A["opt_batch_size = 64<br/>default: accuracy bar met"] -->|opt in| B["opt_batch_size = 128<br/>fewer steps per epoch"]
    B --> C["_stage_learning_rates()<br/>scale = max(1, bs/64)"]
    C --> D["rotation/weight/quantizer LRs<br/>0.05/1e-5/1e-6 → 0.1/2e-5/2e-6"]
    D --> E["+0.44% PPL instead of +2.16%"]
Loading

Changes

  • gptqmodel/quantization/config.py: default back to opt_batch_size = 64, with the measured trade-off in the comment.
  • gptqmodel/looper/paro_processor.py: _stage_learning_rates() (scale max(1.0, opt_batch_size / 64)) feeds both stage entry points instead of reading self.qcfg.opt_*_lr directly. Batches at or below 64 keep the LRs they always had.
  • tests/test_paro.py: the dispatch test pinned the 128 default; it now pins 64.
  • tests/test_paro_batch_lr_5306.py: new — reference batch keeps LRs, opt-in 128 doubles them, small batches keep them, explicit LRs scale from their own value.

Tests

  • tests/test_paro.py + tests/test_paro_batch_lr_5306.py: 249 passed.
  • uvx [email protected] check gptqmodel docs/eora tests setup.py: clean.
  • At the default (64 rows) the code path is numerically unchanged: _stage_learning_rates() returns exactly the configured LRs.

Fixes #5306

#5279 raised ParoConfig.opt_batch_size from 64 to 128 for speed, which halved
the optimizer steps per epoch at a fixed LR. On Llama-3.2-1B-Instruct that
cost 2.2% wikitext-2 PPL on the benchmark harness, giving back most of the
accuracy #5175 had recovered.

Scale the three stage LRs from the 64-row reference, so an opt-in larger step
still moves proportionally further per epoch, and put the default back on the
accuracy-tuned 64 rows.

Measured on Llama-3.2-1B-Instruct (Paro 4-bit g128 fp16, 128 C4 docs,
quantize -> save -> reload -> wikitext-2, 80x512):

  bs=64, 1x LR       20.0401  (reference)
  bs=128, 1x LR      20.4726  (+2.16%)
  bs=128, 2x LR      20.1953  (+0.77%)
  bs=128, 3x LR      20.1274  (+0.44%)
  bs=128, 4x LR      20.3361  (+1.48%)

Linear LR scaling recovers most of the loss but not all of it: the remaining
gap is the coarser best-state selection at half the validation checkpoints,
which no LR can fix. The default therefore stays at 64, and the scaling keeps
opt-in larger batches close to it.

tests/test_paro.py: 249 passed. tests/test_paro_batch_lr_5306.py: 5 new tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant