Skip to content

docs: document eager experts_implementation requirement for MoE-quantized inference - #2620

Merged
Ti-Tai Wang (titaiwangms) merged 2 commits into
mainfrom
docs/moe-eager-inference-caveat
Aug 13, 2026
Merged

docs: document eager experts_implementation requirement for MoE-quantized inference#2620
Ti-Tai Wang (titaiwangms) merged 2 commits into
mainfrom
docs/moe-eager-inference-caveat

Conversation

@titaiwangms

Copy link
Copy Markdown
Contributor

Describe your changes

Documents a limitation surfaced while validating KQuant/RTN MoE quantization on a real (locally-constructed) Qwen3MoeForCausalLM model: transformers may auto-select the "grouped_mm" experts implementation at inference time (even on CPU), which internally calls weight.transpose(-2, -1) on the fused-experts weight before its matmul kernel. Olive's 3D fused-expert QuantTensor is storage-only and cannot represent a transpose without a lossy dequantize/re-quantize round trip, so this raises a RuntimeError at inference time -- even for architectures whose checkpoint layout (is_transposed=False) is already fully supported for quantization by Rtn/Gptq/KQuant.

This reproduces identically for both Rtn (merged, #2616) and KQuant (#2618), confirming it's a shared QuantTensor limitation rather than a pass-specific bug.

Adds a short doc section next to the existing "moe and ONNX export" note, documenting the workaround (model.set_experts_implementation("eager") before running inference) and linking the follow-up issue.

Follow-up issue: #2619 (tracks whether the deferred "transposed layout" (is_transposed=True) QuantTensor design work could also resolve this as a side effect, or whether it needs separate design).

Doc-only change, no code/test changes.

…for native inference

QuantTensor's 3D fused-expert quantization is storage-only and cannot
represent a transpose without a lossy dequantize/re-quantize round trip.
Some transformers experts_implementation strategies (e.g. grouped_mm,
which may be auto-selected even on CPU) call weight.transpose(-2, -1)
before their matmul kernel, which crashes against a QuantTensor even for
architectures whose checkpoint layout is fully supported for
quantization (is_transposed=False). Document the model.set_experts_implementation("eager")
workaround and link the follow-up issue (#2619) tracking a more general
fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e10674c1-6909-4b09-9f5a-d41b28c89d2d
Copilot AI lite review requested due to automatic review settings August 12, 2026 20:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Olive’s quantization documentation to capture a transformers MoE inference-time limitation affecting moe=True-quantized fused-expert weights, and documents the practical workaround needed for native PyTorch inference.

Changes:

  • Adds a new documentation section explaining that some transformers MoE experts implementations (e.g. "grouped_mm") may call weight.transpose(-2, -1) and can crash with Olive’s storage-only 3D QuantTensor.
  • Documents the recommended workaround for native PyTorch inference: model.set_experts_implementation("eager").
  • Links to the tracking follow-up issue (#2619).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@titaiwangms Ti-Tai Wang (titaiwangms) added the documentation Improvements or additions to documentation label Aug 12, 2026
@titaiwangms
Ti-Tai Wang (titaiwangms) enabled auto-merge (squash) August 13, 2026 19:38
@titaiwangms
Ti-Tai Wang (titaiwangms) merged commit 5623f5b into main Aug 13, 2026
10 checks passed
@titaiwangms
Ti-Tai Wang (titaiwangms) deleted the docs/moe-eager-inference-caveat branch August 13, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants