Nunchux AI发布VC-Attention:免训练低比特注意力加速视频D
Nunchux AI Introduces VC-Attention: A Training-Free Low-Bit Attention Kernel That Speeds Up Video Diffusion Transformers
视频生成推理优化的硬核工程实践,直接解决DiT核心瓶颈,数据详实且对比充分,做视频AI落地的同学值得参考。
Nunchux AI has released VC-Attention, a training-free low-bit attention kernel built for video Diffusion Transformers (DiTs). It targets 2 problems at once: value quantization error and a slow softmax stage.
Nunchux AI 发布了 VC-Attention,这是一种专为视频扩散 Transformer(DiTs)设计的免训练低比特注意力内核。它同时针对两个问题:值量化误差和缓慢的 softmax 阶段。
Why Attention is the Video Bottleneck
为什么注意力是视频的瓶颈
Video DiTs flatten a clip into 1 sequence of spatiotemporal tokens and run full self-attention at every layer. A 5-second 720p Wan2.2-14B clip spans about 70K tokens. On the RTX 5090, attention takes more than 64% of generation time. The research team states that attention is about two thirds of every MiniMax-H3 denoising step on a single B200.
视频 DiT 将一段视频展平为时空 token 序列,并在每一层运行全自注意力。一个 5 秒、720p 分辨率的 Wan2.2-14B 片段包含约 70K 个 token。在 RTX 5090 上,注意力机制占生成时间的 64% 以上。研究团队指出,在单块 B200 上,注意力约占 MiniMax-H3 去噪步骤中三分之二的耗时。
Low-bit Tensor Cores speed up the 2 matrix products, QK and PV. 2 obstacles remain. First, prior methods like SageAttention2 smooth queries and keys. After QK smoothing and rotation, the value term accounts for 82% of output error on Wan2.2. Second, the softmax between the products still runs in FP32. On B200 and H200, that exponential and its FP8 cast become the longest pipeline stage.
低比特 Tensor Core 加速了 QK 和 PV 这两个矩阵乘法。但仍存在两个障碍。首先,像 SageAttention2 这样的先前方法会对查询(queries)和键(keys)进行平滑处理。经过 QK 平滑和旋转后,值项在 Wan2.2 的输出误差中占比高达 82%。其次,乘法之间的 softmax 仍以 FP32 运行。在 B200 和 H200 上,指数运算及其 FP8 转换成为最长的流水线阶段。
V-Smooth: Fixing Value Outliers
V-Smooth:解决值异常值问题
Value outliers sit in a few tokens, and their channels shift across heads, layers, and steps. A Hadamard rotation preserves token norms, so it does not remove them. Rotating V changes value error by just 0.2%.
值异常值集中在少数 token 中,且其通道在不同头(heads)、层(layers)和步骤(steps)之间发生偏移。Hadamard 旋转保留了 token 的范数,因此无法消除它们。对 V 进行旋转仅使值误差改变 0.2%。
V-Smooth takes a different route:
V-Smooth 采取了不同的路径:
- Group: An online k-means clusters value tokens per batch and head. Keys and values are permuted together, so non-causal attention output is unchanged.
- Demean: Each 128-token hardware block subtracts its mean. Only the residual is quantized, using per-channel E4M3 at 8 bits or NVFP4 at 4 bits.
- Restore: The mean is added back using the row sum online softmax already keeps. No second pass or extra buffer is needed.
- 分组(Group):在线 k-means 按批次和头对值 token 进行聚类。键和值一起进行置换,因此非因果注意力的输出保持不变。
- 去均值(Demean):每个 128-token 的硬件块减去其均值。仅对残差进行量化,使用每通道 E4M3(8 位)或 NVFP4(4 位)。
- 还原(Restore):利用在线 softmax 已维护的行和加回均值。无需第二遍扫描或额外缓冲区。
Averaged over 100 Wan2.2 heads, the block mean removes 8% of block energy in sequence order. It removes 12% under DeltaQuant’s static cube and 36% after sorting. Each mean costs 0.125 bit per value element.
在 100 个 Wan2.2 头上平均计算,按序列顺序的块均值消除了 8% 的块能量。在 DeltaQuant 的静态立方体下消除了 12%,排序后消除了 36%。每个均值每个值元素成本为 0.125 位。
Grouping runs only on the first 25% of denoising steps. The permutation is reused across 4 adjacent steps. Averaged over the full schedule, grouping costs 3 to 4% of attention time.
分组仅在去噪步骤的前 25% 运行。置换操作在相邻的 4 个步骤中复用。在整个调度过程中平均计算,分组占用注意力时间的 3% 到 4%。
ExpCast-FP8: Removing the Softmax Bottleneck
ExpCast-FP8:移除 Softmax 瓶颈
An E4M3 byte is already close to a logarithm of the value it stores. Read as an integer, it equals roughly 8 log2(v) + 56. So ExpCast-FP8 writes the byte directly from the log-domain score with 1 fused multiply-add. The constant β = -0.35 centers the leftover error, and no constant is fitted per model.
E4M3 字节已经接近其所存储值的对数。作为整数读取时,它大约等于 8 log2(v) + 56。因此,ExpCast-FP8 通过一次融合乘加运算直接从对数域分数写入该字节。常数 β = -0.35 用于居中剩余误差,且无需为每个模型拟合常数。
The direct path writes the same byte as the FP32 exponent-then-cast path on 79.6% of each doubling. Elsewhere it lands 1 code away. The paper proves a per-row total variation bound under 3.64%, plus any underflow tail. Across 204.8K Wan2.2 attention rows, the measured average is 1.6%. ExpCast-FP8 applies only to the 8-bit kernel, since NVFP4 has no single affine log-to-code map.
直接路径在每次翻倍时,有 79.6% 的概率写入与 FP32 指数-然后转换路径相同的字节。在其他情况下,它偏离 1 个代码单位。论文证明了每行总变差界低于 3.64%,加上任何下溢尾部。在 204.8K Wan2.2 注意力行中,测得的平均值为 1.6%。ExpCast-FP8 仅适用于 8-bit 内核,因为 NVFP4 没有单一的仿射对数到代码映射。
Hand-written CuTe/CUDA fusion of the preprocessing chain cuts 1 V-Smooth call from 42.2 ms to 4.8 ms on B200.
手动编写的 CuTe/CUDA 预处理链融合将 B200 上的 V-Smooth 调用从 42.2 ms 减少到 4.8 ms。
Explainer: How VC-Attention Works
解释器:VC-Attention 如何工作
Benchmarks
基准测试
Tests cover 4 open-weight video DiTs: Wan2.2-T2V-A14B, LongCat-Video, HunyuanVideo-1.5, and MiniMax-H3. Fidelity is scored against BF16 FlashAttention-4 outputs over 100 prompts.
测试涵盖 4 个开源视频 DiTs:Wan2.2-T2V-A14B、LongCat-Video、HunyuanVideo-1.5 和 MiniMax-H3。保真度是根据 100 个提示下的 BF16 FlashAttention-4 输出进行评分的。
| GPU (Wan2.2) | Precision | Attention speedup | End-to-end speedup |
|---|---|---|---|
| B200 | 8-bit | 1.59× | 1.19× |
| H200 | 8-bit | 1.46× | 1.13× |
| RTX PRO 6000 | 4-bit | 2.27× | 1.36× |
| RTX 5090 | 4-bit | 3.58× | 1.70× |
| GPU (Wan2.2) | 精度 | 注意力加速比 | 端到端加速比 |
|---|---|---|---|
| B200 | 8-bit | 1.59× | 1.19× |
| H200 | 8-bit | 1.46× | 1.13× |
| RTX PRO 6000 | 4-bit | 2.27× | 1.36× |
| RTX 5090 | 4-bit | 3.58× | 1.70× |
On B200, VC-Attention is 6.02× faster than SageAttention2, which ships no Blackwell kernel. On H200, the gap is 1.16×. On workstation cards, 4-bit V-Smooth matches SageAttention3 on the RTX PRO 6000. It stays within 5% on the RTX 5090, so fidelity separates them.
在 B200 上,VC-Attention 比 SageAttention2 快 6.02 倍,后者没有提供 Blackwell 内核。在 H200 上,差距为 1.16 倍。在工作站显卡上,4-bit V-Smooth 在 RTX PRO 6000 上与 SageAttention3 持平。它在 RTX 5090 上保持在 5% 以内,因此保真度将它们区分开来。
Fidelity results:
保真度结果:
- At 8 bits, V-Smooth adds 2.3 dB PSNR over SageAttention2 on Wan2.2 and 2.8 dB on HunyuanVideo-1.5.
- Adding ExpCast-FP8 gives back 0.7 to 2.1 dB but still beats SageAttention2 on all 4 models.
- At 4 bits, V-Smooth beats SageAttention3 by 2.9 dB on Wan2.2 and 3.6 dB on LongCat-Video.
- Run training-free, Attn-QAT falls 3.4 to 6.7 dB below SageAttention2.
- 在 8 位精度下,V-Smooth 在 Wan2.2 上比 SageAttention2 增加 2.3 dB PSNR,在 HunyuanVideo-1.5 上增加 2.8 dB。
- 添加 ExpCast-FP8 可恢复 0.7 到 2.1 dB,但在所有 4 个模型上仍优于 SageAttention2。
- 在 4 位精度下,V-Smooth 在 Wan2.2 上比 SageAttention3 高 2.9 dB,在 LongCat-Video 上高 3.6 dB。
- 运行免训练的 Attn-QAT,其性能比 SageAttention2 低 3.4 到 6.7 dB。
On MiniMax-H3 at 1344×768, attention runs 1.60× faster than BF16 FlashAttention-4 on B200. PSNR is 20.2 dB versus 19.9 dB for SageAttention2. On B300, the paper reports 1.47× versus 1.31× for a naive FP8 kernel. The blog chart lists 1.51× for B300.
在 MiniMax-H3 的 1344×768 分辨率下,注意力在 B200 上比 BF16 FlashAttention-4 快 1.60 倍。PSNR 为 20.2 dB,而 SageAttention2 为 19.9 dB。在 B300 上,论文报告了 1.47× 对比朴素 FP8 内核的 1.31×。博客图表列出 B300 为 1.51×。
Nunchux Attention, the company's proprietary extension, reaches 1.91× on B200 and 1.83× on B300 for MiniMax-H3 attention.
Nunchux Attention(该公司的专有扩展)在 MiniMax-H3 注意力上,于 B200 达到 1.91×,在 B300 达到 1.83×。
The method changes only per-interaction cost. So it can compose with sparse attention like Sparse VideoGen and Radial Attention, and distillation and multi-GPU execution. Nunchux says free MiniMax-H3 access is coming through its Modelverse waitlist.
该方法仅改变每次交互的成本。因此,它可以与稀疏注意力(如 Sparse VideoGen 和 Radial Attention)、蒸馏和多 GPU 执行组合使用。Nunchux 表示,通过其 Modelverse 等待名单,即将免费提供 MiniMax-H3 访问权限。
Key Takeaways
关键要点
- VC-Attention is training-free low-bit attention for video DiTs from Nunchux AI.
- V-Smooth clusters value tokens, then quantizes only residuals after block-mean subtraction.
- ExpCast-FP8 replaces the FP32 exponential and cast with 1 multiply-add.
- Wan2.2 attention runs 1.59× faster on B200 and 3.58× on RTX 5090.
- No public kernel release yet; Nunchux runs a proprietary extension in its stack.
- VC-Attention 是 Nunchux AI 推出的用于视频 DiTs 的免训练低位注意力机制。
- V-Smooth 对值 token 进行聚类,然后在减去块均值后仅量化残差。
- ExpCast-FP8 用 1 次乘加运算替换了 FP32 指数和转换操作。
- Wan2.2 注意力在 B200 上运行速度提高 1.59 倍,在 RTX 5090 上提高 3.58 倍。
- 尚未发布公共内核版本;Nunchux 在其技术栈中运行专有扩展。
Check out the Paper and Technical details. All credit goes to the researcher of this project. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
查看论文和技术细节。所有功劳归于该项目的研究者。此外,欢迎在 Twitter 上关注我们,并别忘了加入我们拥有 150k+ 成员的 ML SubReddit 以及订阅我们的新闻通讯。等等!你在 Telegram 上吗?现在你也可以加入我们的 Telegram 群组。
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
需要与我们合作推广你的 GitHub 仓库、Hugging Face 页面、产品发布或网络研讨会等?请联系我们要
The post Nunchux AI Introduces VC-Attention: A Training-Free Low-Bit Attention Kernel That Speeds Up Video Diffusion Transformers appeared first on MarkTechPost.
MarkTechPost 上首先刊登的文章《Nunchux AI 推出 VC-Attention:一种免训练的低位注意力内核,可加速视频扩散 Transformer》
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力