You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] EXL3: quantization crashes on dense models (META placeholder weights reused in later forwards; repo's exl3 recovery tests fail); dims not multiple of 128 fail after calibration #4006
1. EXL3 quantization crashes on a plain dense model: META placeholder weights are not re-materialised for later forwards (high)
After a module is packed, EXL3 swaps its weight for a META placeholder (looper/exllamav3_processor.py:2347_stage_runtime_weight). The hook that brings it back (:2388prepare_runtime_weight_for_forward) runs only for modules in the current subset (looper/stage_subset.py:916-926), or when a whole layer is skipped (stage_layer.py:1060-1120). The next subset's capture forward and replay_after_process therefore run the already-quantized q/k/v with META weights.
A 2-layer Llama fails in layer 0. The repo's own tests fail at HEAD:
cd tests && CUDA_VISIBLE_DEVICES=<one gpu> python -m pytest -q \
"test_checkpoint_method_compatibility.py::test_specialized_checkpoint_recovery[term-exl3]"
E failed to move parameter 'weight' of HookedLinear to cuda:0
E NotImplementedError: Cannot copy out of meta tensor; no data!
test_moe_method_checkpoint_recovery[*-exl3] fails the same way.
Fix: before every subset forward, and before _replay_layer_outputs, call processor.prepare_runtime_weight_for_forward on every NamedModule in the layer (full), not just the current subset. With that change patched in, the run completes and saves. Reloaded ExllamaV3Linear outputs are bitwise equal to the in-memory modules, and logits vs fp have relative error 0.048 with 95% top-1 agreement.
2. The generic EXL3 path neither pads nor validates dims that aren't multiples of 128, so it fails with a bare AssertionError after calibration (medium)
exllamav3_processor.py:2324 (_quant_input_weight) passes the weight unpadded, which hits the asserts at exllamav3/modules/quant/exl3_lib/quantize.py:353, 367, 482. The model-specific cores already pad outputs to ceil(out/128)*128 (utils/glm5_core.py:66, step5_core.py, kimi_k3_core_format.py), and the runtime supports padded stored features. The generic EXL3Processor / preprocess / EXL3Config don't.
hidden=192, intermediate=320 -> RuntimeError: EXL3 quantization failed ... {"error":"","error_type":"AssertionError"} ... q_proj
direct quantize_exl3 on (144,208), (48,32), (16,16): AssertionError
Any model with a hidden or intermediate size not divisible by 128 (e.g. 576-wide SmolLM-class models) gets through the full calibration pass first.
Fix: pad output columns to a multiple of 128 as glm5_core does, and pad inputs with zero rows plus a regularised Hessian. Otherwise, reject or skip the module in preprocess with a clear message.
Follow-up: the fix is bypassed under the default auto_dtype_cast=auto_nf12 (every bf16 model). stage_subset.py:942 swaps the raw module into full, and prepare_layer_runtime_weights_for_forward skips non-NamedModule entries, so EXL3 still crashes with Cannot copy out of meta tensor. Details: #4063 item 2.
Activity
docs(exl3): reference the introducing PR (#4006)
fix(exl3): refresh deferred runtime weights per layer forward and ali…
Qubitium commentedon Nov 14, 2026
Follow-up: the fix is bypassed under the default
auto_dtype_cast=auto_nf12(every bf16 model).stage_subset.py:942swaps the raw module intofull, andprepare_layer_runtime_weights_for_forwardskips non-NamedModule entries, so EXL3 still crashes withCannot copy out of meta tensor. Details: #4063 item 2.