Repository navigation
[Transformers backend] Fuse the GLU activation with the down projection's input quant - #66809
Merged
hmellor merged 6 commits intoNov 11, 2026
Merged
Conversation
…on's input quant The GLU fuser now rewrites down(act(gate_up(x))) to down(maybe_fused_act_quant(act, gate_up(x), down)), as native Llama does, so NVFP4 uses the fused SiLU-and-mul + quant kernel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
6 of 15 tasks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Member
Author
|
/ci run |
|
✅ Triggered Buildkite CI #101477 for commit ℹ️ This PR is 1 commit behind upstream |
hmellor
enabled auto-merge (squash)
November 10, 2026 12:42
Isotr0py
approved these changes
Nov 10, 2026
Member
Author
|
/ci retry |
|
✅ Queued 6 failed job(s) for retry in Buildkite CI #101477. |
Dynamo looked up the injected maybe_fused_act_quant global on the Transformers modeling module when building guards, which failed. The rewrite is now down(act(y, down)) and ActAndMulQuant calls maybe_fused_act_quant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Member
Author
|
/ci run |
|
✅ Triggered Buildkite CI #101494 for commit |
Member
Author
|
The |
Member
Author
|
/ci retry |
|
✅ Triggered Buildkite CI #101740 for commit |
20 of 24 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Let the Transformers modeling backend fuse a GLU activation with its down projection's input quantization, as native Llama does with
maybe_fused_act_quant. This closes the NVFP4 throughput gap listed in #66547 (serving Llama with the backend).Claims
down(act(gate_up(x)))todown(act(gate_up(x), down))when the activation feeds the down projection directly, and wraps the activation inActAndMulQuant, which callsmaybe_fused_act_quant(act, x, down). For HF'sLlamaMLP:maybe_fused_act_quantfalls back to the plain activation.Validation
B200,
RedHatAI/Llama-3.1-8B-Instruct-NVFP4, 1024 in / 256 out, 1000 prompts, mean of 4 runs (2 GPUs × 2 rounds, alternating):mainPrompt logprobs over 1577 tokens: mean NLL native 2.1295, backend
main2.1301, this PR 2.1268; mean |Δlogprob| vs native is 0.2011 for backendmainand 0.2046 for this PR, so the fused path is as close to native as the unfused one. GSM8K (1319 questions, 5-shot, greedy): native 0.689, backendmain0.688, this PR 0.673. Given the matching logprobs, I read the GSM8K gap as greedy paths diverging under NVFP4 rather than a numerical regression.vllm bench throughput --model RedHatAI/Llama-3.1-8B-Instruct-NVFP4 --model-impl {vllm,transformers} --input-len 1024 --output-len 256 --num-prompts 1000 pytest tests/models/transformers/fusers/test_linear.pytest_linear.py: 58 passed. The new assertion intest_detects_and_rewrites_glufails onmainand passes here.tests/models/transformers/test_backend.pyand Gemmatest_commonpass on B200 (test_distributedfails the same way onmainon that host).Details
The down projection is passed to the activation, rather than the rewritten forward calling
maybe_fused_act_quantas a global: Dynamo resolves a function's globals through its module when building guards, and the rewritten forward's module is the Transformers modeling module. The rewrite only applies when the down projection's single argument is the activation call itself; anything in between (casts, dropout) leaves the forward as before.No open PR covers this (searched for
maybe_fused_act_quant, GLU fuser and Transformers backend NVFP4).Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
🤖 Generated with Claude Code