Skip to content

fix(paro): carry per-module krot, kernel and fallback into the packed layer - #5675

Merged
Qubitium merged 1 commit into
mainfrom
fix/5659-paro-overrides
Nov 20, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/5659-paro-overrides

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

Two defects left behind by #5573, found in a post-merge review of #5638.

  1. Per-module Paro krot never reached the packed layer. resolve_module_constructor_config() has branches for FP8, bitsandbytes, GGUF and MXFP4 but none for FORMAT.PARO, so a krot rule stayed out of the constructor options. ParoProcessor packed with init_kwargs=self.qcfg.quant_linear_init_kwargs() (the run-level krot) and then copied the optimizer's buffers in. With top=8, dyn=1 the copy broadcast one Givens sweep across every stage; with top=8, dyn=16, top=1, dyn=8 and top=8, dyn=4 it raised RuntimeError inside copy_. A per-module kernel was lost the same way.
  2. Per-module Paro fallback was cloned then ignored. preprocess() set self.fallback from the run-level config, and both _module_fallback_requested() and _log_fallback() read it. Top-level 0.5% with a module rule of 1.0% and 5 of 1000 calibration rows: the clone said fall back, the processor did not.

Also fixed in the same area: an explicit None in a dynamic rule now means "inherit" instead of crashing ({"krot": None} reached int(None) inside the clone's __post_init__ and raised a bare TypeError).

Fixes #5659

What Changed

  • gptqmodel/quantization/module_config.py: new FORMAT.PARO branch that normalizes krot into the constructor options, rejecting 0, negatives, bools, non-integers and fractional floats the way ParoConfig.__post_init__ does.
  • gptqmodel/looper/paro_processor.py:
    • packing builds the layer from the module's own quant_linear_init_kwargs() (so krot and kernel come from the resolved rule);
    • a pairs/theta shape guard names the krot mismatch instead of relying on a shape-compatible copy;
    • fallback decisions, fallback logging and the missing-features guard read the module's resolved fallback, falling back to the processor value for synthetic configs.
  • gptqmodel/quantization/config.py: a None value in a dynamic rule is dropped before validation, so it inherits the run-level setting; _validate_dynamic_module_scope no longer rejects a None scope key; apply_module_overrides skips None defensively.
  • tests/test_paro_dynamic_overrides_5659.py: new regression file (7 tests). No API change.

Out of scope: damp_percent/static_groups are still accepted per module with no Paro consumer; that needs a decision on whether to reject them, not a silent fix.

Tests

# new file, with the fix
python -m pytest tests/test_paro_dynamic_overrides_5659.py -q -p no:randomly
# 7 passed

# same file on unmodified main
# 6 failed, 1 passed

# neighbouring dynamic/Paro coverage
python -m pytest tests/test_paro_dynamic_overrides_5659.py \
    tests/test_dynamic_overrides_applied_5573.py \
    tests/test_dynamic_config_invalidation_4475.py \
    tests/test_dynamic_exclusion_order_4198.py -q -p no:randomly
# 29 passed

python -m pytest tests/test_awq_dynamic_bits_gate_5408.py tests/test_awq_dynamic_group_size.py \
    tests/test_gguf_dynamic_format.py tests/test_model_dequant_dynamic_bits.py -q -p no:randomly
# 46 passed

bash format/check.sh
# ruff 0.14.2 - All checks passed!

tests/test_paro.py reports 23 failures on this CPU-only host (fused-rotation gradient and launch-plan tests); the identical 23 fail on unmodified main, so they are pre-existing and unrelated.

The packed-layer test builds a real ParoLinear through create_quant_module and asserts krot/pairs/theta are sized by the module rule, which is the exact path that used to broadcast.

  • Unit tests have been executed and passed, or the reason they are not applicable is documented.
  • I added a new simple/fast unit test for this change, or documented why that is not applicable.

Model Support / Module Plan

Not applicable: no MODEL_MAP, definition, or module-plan change.

AWQ onboarding safety

Not applicable: no AWQ grouping, search, replay or fold change.

#5573 applied every dynamic field to a per-module config clone, but for Paro
two of them stopped there.

resolve_module_constructor_config() had no FORMAT.PARO branch, so a
per-module krot never reached the constructor: the packed ParoLinear was built
from the top-level value while the optimizer produced buffers for the module's
value. pairs.copy_ then either broadcast one Givens sweep across every stage
(top=8, dyn=1) or raised RuntimeError (top=8, dyn=16). The same gap dropped a
per-module kernel.

The fallback threshold was read from the processor, so a per-module fallback
rule changed the clone and nothing else.

Changes:
* module_config: a PARO branch normalizes krot into the constructor options,
  rejecting the same values ParoConfig rejects.
* paro_processor: packing builds the layer from the module's own
  quant_linear_init_kwargs() (krot + kernel), and a pairs/theta shape guard
  names a krot mismatch instead of relying on a shape-compatible copy.
* paro_processor: fallback decisions, logging and the missing-features guard
  read the module's resolved fallback, falling back to the processor value.
* config: an explicit None in a dynamic rule means inherit. It is dropped
  before validation, so {"krot": None} no longer reaches int(None) inside the
  clone's __post_init__, and a None scope key is no longer rejected.

Tests: tests/test_paro_dynamic_overrides_5659.py (7 tests; 6 red on main).
Fixes #5659
@Qubitium
Qubitium marked this pull request as ready for review November 20, 2026 05:26
@Qubitium
Qubitium merged commit 72b42d0 into main Nov 20, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/5659-paro-overrides branch November 20, 2026 05:32
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.

paro: per-module krot and fallback overrides do not reach the packed module

1 participant