Skip to content

[9/9] Retain guarded experimental GDN approximate-inverse QAT - #2507

Draft
kaix-nv wants to merge 1 commit into
kaix/linear-attention-qat-m2from
kaix/linear-attention-qat-m4
Draft

kaix-nv wants to merge 1 commit into
kaix/linear-attention-qat-m2from
kaix/linear-attention-qat-m4

Conversation

@kaix-nv

@kaix-nv kaix-nv commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge order: 9 draft PRs

#3077 → #2519 → #3078 → #2657 → #2805 → #2788 → #2878 → #2503 → #2507

#2497 is already on main. Each PR is based on the preceding branch; #3077 is based on main.

What does this PR do?

Type of change: New feature.

Keep the approximate-inverse investigation as the final draft in the stack. The unguarded Neumann candidate failed numerical, model-quality and cost gates and is not a supported optimization.

The repaired policy evaluates the polynomial only when a sufficient truncation bound holds: for r = ||L||_inf < 1, require r^(degree+1)/(1-r) below the configured threshold. Unsafe matrices use an exact solve by default or raise when explicitly configured. Exact solve remains the default, and no built-in recipe enables the approximation.

The guard bounds exact-arithmetic truncation, not FP32 roundoff or model quality. Tests retain the correlation-0.9 failure case and check safe polynomial gradients and unsafe fallback. A high fallback rate cannot be reported as a speedup. The current implementation is GDN research only.

Usage

linear_attention:
  - module_name: "*"
    cfg:
      backend: gdn_prefill
      precision: gdn_prefill
      solve:
        method: guarded_neumann
        degree: 15
        max_tail_bound: 0.001
        unsafe_action: exact

See the guarded-inverse report.

Testing

Restacked on main 580ffff1cddb9b20a38b7434e6290654ebf96a8f on 2026-10-27; this PR head is 9f913d907c298efeb99daf84a7c32246cf38208a.

  • Combined stack at 9f913d907c298efeb99daf84a7c32246cf38208a: 226 tests passed in 108.95 seconds, covering TensorQuantizer defaults/calibration/folding/restore, state policies, independent recurrence and gradient references, replay cache lifecycle, CUDA graphs, packed two-precision gradients, GDN operand QDQ and guarded inverse behavior. These are stack-tip results; intermediate heads were not all rerun separately.
  • Changed-file pre-commit checks passed (including Ruff, mypy and Bandit). The recipe checker was run separately with the installed Python environment; all eight changed complete recipes loaded successfully.
  • All nine parent links, signed commits, Python syntax and diff checks verified. Every rebuilt branch is free of the removed biased mode; released changelog entries are preserved.
  • Local environment: RTX A6000/SM86, PyTorch 2.9.1+cu128, Triton 3.5.1. The regular GPU tests use independent reference prefixes where native vLLM is unavailable. The vLLM 0.30 engine, supported Megatron/Bridge environment, FLA 0.5.2 on Hopper/Blackwell, and full-model accuracy were not rerun. These results are not new model-quality or throughput evidence.

Before your PR is "Ready for review"

  • Backward compatibility: opt-in; existing default behavior is retained.
  • Necessary tests: existing focused suites extended or retained; validation and environment limits listed above.
  • Dependencies: optional versions and setup are documented with the example; this restack adds no dependency.
  • Changelog: updated under 0.49; released 0.48 entries preserved.
  • Owner review and CI for the new head remain required. Keep draft.

@copy-pr-bot

copy-pr-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.80519% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.63%. Comparing base (6d10361) to head (9f913d9).

Files with missing lines Patch % Lines
...opt/torch/quantization/linear_attention/prefill.py 60.00% 2 Missing ⚠️
...elopt/torch/quantization/linear_attention/solve.py 96.61% 2 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##           kaix/linear-attention-qat-m2    #2507      +/-   ##
================================================================
+ Coverage                         72.61%   72.63%   +0.02%     
================================================================
  Files                               681      682       +1     
  Lines                             77317    77390      +73     
================================================================
+ Hits                              56140    56211      +71     
- Misses                            21177    21179       +2     
Flag Coverage Δ
unit 60.82% <94.80%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kaix-nv
kaix-nv removed this pull request from stack #2510 September 23, 2026 01:07
@kaix-nv
kaix-nv force-pushed the kaix/linear-attention-qat-m4 branch from 34e549e to ff21e39 Compare September 23, 2026 01:16
@kaix-nv kaix-nv changed the title Add experimental Neumann solve policy and qualification study [4/4] Experimental GDN/KDA approximate-inverse QAT Sep 23, 2026
@kaix-nv
kaix-nv changed the base branch from kaix/linear-attention-qat-m3 to kaix/linear-attention-qat-m2 September 23, 2026 01:16
@kaix-nv
kaix-nv added this pull request to stack #2521 September 23, 2026 01:22
@kaix-nv kaix-nv changed the title [4/4] Experimental GDN/KDA approximate-inverse QAT [5/5] Experimental GDN/KDA approximate-inverse QAT Sep 24, 2026
@kaix-nv
kaix-nv removed this pull request from stack #2521 September 24, 2026 06:17
@kaix-nv
kaix-nv added this pull request to stack #2542 September 24, 2026 06:18
@kaix-nv
kaix-nv force-pushed the kaix/linear-attention-qat-m4 branch from ff21e39 to f3ce747 Compare September 24, 2026 06:30
@kaix-nv
kaix-nv removed this pull request from stack #2542 September 24, 2026 06:31
@kaix-nv
kaix-nv added this pull request to stack #2543 September 24, 2026 06:31
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/Model-Optimizer/pr-preview/pr-2507/

Built to branch gh-pages at 2026-10-28 06:02 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@kaix-nv
kaix-nv force-pushed the kaix/linear-attention-qat-m4 branch from f3ce747 to 99d02c3 Compare September 24, 2026 18:17
@kaix-nv
kaix-nv force-pushed the kaix/linear-attention-qat-m4 branch from 99d02c3 to 9d3c35f Compare September 25, 2026 01:54
@kaix-nv
kaix-nv force-pushed the kaix/linear-attention-qat-m4 branch 2 times, most recently from 1dd4bb1 to 999fe60 Compare September 25, 2026 05:11
@kaix-nv
kaix-nv removed this pull request from stack #2563 October 5, 2026 06:15
@kaix-nv
kaix-nv added this pull request to stack #2658 October 5, 2026 06:15
@kaix-nv kaix-nv changed the title [6/6] Experimental GDN/KDA approximate-inverse QAT [7/7] Experimental GDN/KDA approximate-inverse QAT Oct 5, 2026
@kaix-nv
kaix-nv removed this pull request from stack #2658 October 8, 2026 18:41
@kaix-nv
kaix-nv added this pull request to stack #2714 October 8, 2026 18:41
@kaix-nv kaix-nv changed the title [7/7] Experimental GDN/KDA approximate-inverse QAT [6/6] Experimental GDN/KDA approximate-inverse QAT Oct 8, 2026
@kaix-nv
kaix-nv removed this pull request from stack #2714 October 14, 2026 06:28
@kaix-nv
kaix-nv added this pull request to stack #2789 October 14, 2026 06:29
@kaix-nv kaix-nv changed the title [6/6] Experimental GDN/KDA approximate-inverse QAT [7/7] Experimental GDN/KDA approximate-inverse QAT Oct 14, 2026
@kaix-nv
kaix-nv removed this pull request from stack #2789 October 14, 2026 20:18
@kaix-nv
kaix-nv added this pull request to stack #2806 October 14, 2026 20:19
@kaix-nv kaix-nv changed the title [7/7] Experimental GDN/KDA approximate-inverse QAT [8/8] Experimental GDN/KDA approximate-inverse QAT Oct 14, 2026
@kaix-nv kaix-nv changed the title [8/8] Experimental GDN/KDA approximate-inverse QAT [8/9] Experimental GDN/KDA approximate-inverse QAT Oct 19, 2026
@kaix-nv
kaix-nv removed this pull request from stack #2806 October 19, 2026 22:19
@kaix-nv
kaix-nv added this pull request to stack #2879 October 19, 2026 22:19
@kaix-nv kaix-nv changed the title [8/9] Experimental GDN/KDA approximate-inverse QAT [10/10] Experimental GDN/KDA approximate-inverse QAT Oct 19, 2026
@kaix-nv
kaix-nv force-pushed the kaix/linear-attention-qat-m4 branch from e6a7d55 to 9f913d9 Compare October 28, 2026 05:56
@kaix-nv
kaix-nv removed this pull request from stack #2879 October 28, 2026 05:58
@kaix-nv kaix-nv changed the title [10/10] Experimental GDN/KDA approximate-inverse QAT [9/9] Retain guarded experimental GDN approximate-inverse QAT Oct 28, 2026
@kaix-nv
kaix-nv added this pull request to stack #3079 October 28, 2026 06:01
@kaix-nv
kaix-nv force-pushed the kaix/linear-attention-qat-m4 branch from 9f913d9 to e078c16 Compare November 17, 2026 01:08

This branch has not been deployed

No deployments
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