Conversation
29293d3 to
50633b9
Compare
|
/azp run Unit-Test-CUDA-AutoRound. |
|
Commenter does not have sufficient privileges for PR 2341 in repo intel/auto-round |
50633b9 to
e2a66f9
Compare
Opt-in joint/two-stage grid search (arXiv 2505.17595) for the optimized-RTN path, carried by RTNConfig and SignRoundConfig: - asym: joint (scale, integer zero-point) two-stage search per group; asymmetric layers had no optimized initializer before (plain min/max RTN only). sym: two-stage signed scale search replacing the incumbent clip search; the winning clamp convention is searched per group. - zero-shot (iters=0): both searches weighted by the activation imatrix, collected automatically. iters>0: the search anchors the SignRound tuning grid (range margins pinned, tuning proceeds on rounding values). - backends: extension Triton kernels (full sweep + shared-multiplier coarse pass), torch.compile, eager fallback; a failing backend is disabled for the rest of the process with a warning. Benchmark (2M groups, g128, 64+32 candidates, RTX 3090): eager 23.8s, compile 0.43s (~55x), Triton 0.33s (~72x). - MoE: same-shape expert projections quantize in one stacked call, bit-identical to per-module. - AR_NEUQI_COARSE/AR_NEUQI_FINE: backend-aware defaults (256/64 on the Triton/compile backends, 64/32 with eager); AR_NEUQI_BACKEND pins a backend for debugging. Validation (full-vocab fp32 KL vs the BF16 base, openwebtext 8x8192, Qwen3.8-27B W4A16 g128, single RTX 3090; details in docs/neuqi_acc.md): sym iters=0 -4.1% mean KL and -32% wall vs the incumbent search (0.02734/9m vs 0.02852/13m19s); SignRoundV2 iters=50 sym -16.6% vs the same recipe without NeUQI (0.02191 vs 0.02626); asym 0.02579 (iters=0), 0.02106 (iters=50), 0.01921 (iters=200). Tests: CPU unit suite (search math, backend-ladder parity with an fp64 tie-oracle, dispatch/config contract, expert batching, anchor invariants incl. bf16/fp16 storage robustness); CUDA tier (Triton kernel parity, tiny-model e2e on the real backend ladder). Docs: environments and step_by_step (EN+CN), neuqi_acc.md, README What's New (EN+CN). Signed-off-by: avtc <tarasenkov@gmail.com>
e2a66f9 to
b9311af
Compare
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@avtc Really appreciate this PR! May I know the additional quantization cost and accuracy results on a few representative tasks, like mmlu? If the accuracy looks good and cost is low, we could consider setting it as the default. |
|
Both NeUQI sym/asym are faster than opt-rtn sym at least on CUDA (
|
| path and is a strict generalization of the symmetric ``search_scales`` grid (which | ||
| fixes ``z = 0``). | ||
|
|
||
| The symmetric counterpart (:func:`neuqi_search_scale_sym`) fixes the zero point at |
There was a problem hiding this comment.
How about moving this to the algorithm? It feels more like an algorithm than a data type, although there may be some coupling if different algorithms want to use it.
@n1ck-guo, what do you suggest?
| ) | ||
| registry.add_argument( | ||
| "--enable_neuqi", | ||
| field="enable_neuqi", |
There was a problem hiding this comment.
@n1ck-guo Should we consolidate this with disable_opt_rtn into a unified qparams_init_method ?
|
|
||
| For the GGUF format, we have optimized the RTN algorithm inspired by llamacpp. To use the original (pure) RTN algorithm instead, enable the `--disable_opt_rtn` option. | ||
|
|
||
| Passing `--enable_neuqi` opts the optimized path into the **NeUQI** grid search ([arXiv 2505.17595](https://arxiv.org/abs/2505.17595)): asymmetric layers run a joint (scale, integer zero-point) search and symmetric layers a two-stage signed scale search, both weighted by the activation imatrix on the zero-shot path, which is collected automatically (with `iters > 0` the anchor runs unweighted). With `iters > 0`, the search result anchors the SignRound tuning grid (frozen init). Grid sizes are tunable via `AR_NEUQI_COARSE`/`AR_NEUQI_FINE` (see [environments](./environments.md)); the unpinned default is backend-aware (wide only on the Triton/torch.compile lanes). Accuracy and wall-time results are shown in [NeUQI accuracy validation](./neuqi_acc.md). |
There was a problem hiding this comment.
@WeiweiZhang1 If the author doesn’t have enough resources to evaluate accuracy on some typical models and tasks, could you help run some evaluations and link the results as we usually do? It would also be helpful to provide users with some guidance on when to trigger this.
Description
This PR adds the NeUQI grid search (arXiv 2505.17595) to the optimized-RTN path, opt-in via
--enable_neuqi(CLI, orenable_neuqi=Truein the API; carried by bothRTNConfigandSignRoundConfig):iters=0) both searches are weighted by the activation imatrix, collected automatically when the flag is set (asymmetric layers previously never consumed one — plain min/max RTN was their only path). Withiters > 0the anchor runs unweighted; tuning itself is data-driven.iters > 0: frozen-init anchor. The search runs once at wrapper init and anchors the SignRound tuning grid — range margins are pinned to the winner, tuning proceeds on the rounding values only. Measured quality-neutral atiters=50on sym with SignRoundV2 (0.02191 vs 0.02203 without), so the anchor is a no-cost initialization once tuning runs.auto_round_extension), a torch.compile implementation, or plain eager PyTorch — and falls back to the next one if a backend fails at runtime (the failed one is disabled for the rest of the process, with a warning).AR_NEUQI_BACKEND=triton|compile|eagerpins a backend, mainly for debugging. Measured on the joint search (2M groups, group size 128, 64+32 candidates, RTX 3090): eager 23.8 s, torch.compile 0.43 s (~55x faster than eager), Triton 0.33 s (~72x).AR_NEUQI_COARSE/AR_NEUQI_FINEcontrol the grid. Defaults are 256/64 when Triton or torch.compile serves the search and 64/32 with eager — the eager cost is proportional to the grid size and measured quality is flat between the two (Qwen3.8-27B W4A16 g128, iters=0: mean KL 0.02570 at 64/32 vs 0.02579 at 256/64). Explicit values always win.Validation — full-vocabulary fp32 KL vs the BF16 base, openwebtext 8x8192 positions; Qwen3.8-27B, W4A16, group size 128, single RTX 3090. Protocol and full statistics: docs/neuqi_acc.md. Sorted by mean KL (lower is better):
All
iters > 0rows use SignRoundV2 (enable_alg_ext).Type of Change
New feature
Related Issues
Relates to #2010 — NeUQI support was requested there.
Checklist Before Submitting