Zyphra发布层级注意力ZHA:稀疏搜索实现亚二次复杂度
Zyphra AI Introduces Zyphra Hierarchical Attention (ZHA): A Path to True Subquadratic Attention
针对长上下文计算痛点的实质性架构创新,提供具体参数与多模型对比数据,值得关注其工程落地潜力。
Zyphra has released Zyphra Hierarchical Attention (ZHA), a sparse attention method built around a tree-structured indexer. ZHA targets a known gap in sparse attention: the indexer that picks tokens still scans the whole context. Zyphra’s technical paper shows ZHA can be distilled into frozen pretrained models with about 4B tokens. On Qwen3.6-35B-A3B it stays close to dense attention on reasoning, agentic coding and 256K retrieval benchmarks.
Zyphra 发布了 Zyphra 分层注意力(ZHA),这是一种围绕树状索引器构建的稀疏注意力方法。ZHA 旨在解决稀疏注意力中的一个已知缺陷:选择 token 的索引器仍需扫描整个上下文。Zyphra 的技术论文显示,ZHA 可以使用约 4B 个 token 蒸馏到冻结的预训练模型中。在 Qwen3.6-35B-A3B 上,其在推理、智能体编码和 256K 检索基准测试中的表现接近密集注意力。
TL;DR
- Size: It is a method that adds 81,920 trainable parameters to Qwen3.6-35B-A3B (about 0.00024%). Tested up to 256K context.
- Runs on: Retrofits frozen pretrained models after a 4B-token KL warmup at 32K context. Speedups come from a modeled H100 BF16 roofline. No optimized kernels released. An FP4 router variant was also tested.
- Performance: Within a few points of dense attention on 7 reasoning, coding and retrieval benchmarks.
- Best: LongBench v2 hits 63.4% (deep tree) vs 58.0% dense, using about 1.1% of keys.
- Worst: On NoPE-based Nemotron-3.5-Lightning-30B-A3B, deep-tree RULER-13 drops 25.3 points below dense.
- 规模:该方法向 Qwen3.6-35B-A3B 添加了 81,920 个可训练参数(约占 0.00024%)。已在 256K 上下文中进行测试。
- 运行环境:在 32K 上下文下进行 4B token 的 KL 预热后,适配冻结的预训练模型。加速效果基于建模的 H100 BF16 屋顶线得出。未发布优化内核。还测试了一种 FP4 路由变体。
- 性能:在 7 项推理、编码和检索基准测试中,其表现与密集注意力相差无几。
- 最佳表现:在 LongBench v2 上达到 63.4%(深层树结构),而密集注意力为 58.0%,仅使用约 1.1% 的键值对。
- 最差表现:在基于 NoPE 的 Nemotron-3.5-Lightning-30B-A3B 上,深层树结构的 RULER-13 比密集注意力低 25.3 分。
What is Zyphra Hierarchical Attention (ZHA)?
什么是 Zyphra 分层注意力(ZHA)?
ZHA is a sparse attention method from Zyphra that finds relevant keys by searching a tree. It keeps the full KV cache. The tree only decides which cached keys each query reads.
ZHA 是 Zyphra 提出的一种稀疏注意力方法,通过搜索树来查找相关的键值对。它保留完整的 KV 缓存。该树仅决定每个查询读取哪些缓存的键值对。
Fixed-state methods like SSMs and sliding windows saturate at long contexts. Fine-grained sparse methods like DeepSeek Sparse Attention score every past token with an indexer. The final attention is sparse, but the indexer still grows with the full context.
像 SSM 和滑动窗口这样的固定状态方法在长上下文下会饱和。像 DeepSeek 稀疏注意力这样细粒度的稀疏方法使用索引器对每个过去的 token 进行评分。最终的注意力是稀疏的,但索引器仍随完整上下文的增长而增长。
Near 1M tokens, cited work shows indexing takes 60 to 90% of layer time. ZHA makes the search itself sparse.
在近 1M token 的情况下,引用研究表明索引操作占层处理时间的 60% 到 90%。ZHA 使搜索过程本身变得稀疏。
How does ZHA’s tree indexer work?
ZHA 的树状索引器是如何工作的?
Building the tree
构建树
ZHA splits keys into contiguous chunks and compresses each chunk into a summary key. Summaries are grouped and compressed again, level by level. With chunk size 4, 6 levels cover 4,096 tokens per top node.
ZHA 将键值对分割为连续的块,并将每个块压缩为一个摘要键。摘要按层级分组并再次压缩。当块大小为 4 时,6 层结构可使每个顶层节点覆盖 4,096 个 token。
Summaries come from a small set of learned reference queries. Each reference query gives a tangent-plane estimate of a chunk’s log attention mass. The max over these planes approximates how much attention any future query would give the chunk.
摘要来自一组少量学习到的参考查询。每个参考查询提供对块的对数注意力质量的切平面估计。这些平面的最大值近似于任何未来查询对该块的注意力分配量。
How does top-p routing pick tokens?
Top-p 路由如何挑选 token?
At decode time, a query scores the top-level nodes. It keeps the smallest set holding a fraction p of estimated attention mass. It then expands only those children, repeating until it reaches raw KV entries.
在解码时,查询会对顶层节点进行评分。它保留包含估计注意力质量分数 p 的最小集合。然后仅扩展这些子节点,重复此过程直到到达原始的 KV 条目。
Top-p makes the budget adaptive. A single-fact lookup touches few branches. A query that needs many scattered facts expands more. The first token is always kept as an attention sink.
Top-p 使预算自适应。单事实查询仅触及少量分支。需要多个分散事实的查询会扩展更多。第一个 token 始终作为注意力汇保留。
How does ZHA perform against dense attention and MSA?
ZHA 在密集注意力和 MSA 方面的表现如何?
Zyphra team converted Qwen3.6-35B-A3B with 2 trees: deep (chunk 4, 6 levels) and wide (chunk 256, 1 level). Both use 16 reference queries and p = 0.95. It also trained a MiniMax Sparse Attention (MSA) indexer on 40B tokens, 10x ZHA’s budget.
Zyphra 团队使用两棵树对 Qwen3.6-35B-A3B 进行了转换:深树(块大小 4,6 层)和宽树(块大小 256,1 层)。两者均使用 16 个参考查询且 p = 0.95。它还在 400 亿 token 上训练了一个 MiniMax 稀疏注意力(MSA)索引器,其预算是 ZHA 的 10 倍。
| Benchmark (Qwen3.6-35B-A3B) | Dense | ZHA deep | ZHA wide | MSA |
|---|---|---|---|---|
| AIME 2026 | 93.1 | 91.2 | 90.8 | 91.7 |
| SWE-bench Verified | 67.4 | 67.4 | 68.4 | 63.6 |
| Terminal-Bench 2.1 | 49.9 | 46.7 | 53.3 | 46.1 |
| MMLU-Pro | 84.9 | 85.3 | 85.2 | 85.3 |
| GPQA Diamond | 84.8 | 85.0 | 85.0 | 83.1 |
| RULER-13 (256K) | 96.0 | 93.3 | 96.2 | 77.1 |
| LongBench v2 (thinking) | 58.0 | 63.4 | 62.4 | 49.3 |
| 基准测试(Qwen3.6-35B-A3B) | 密集注意力 | ZHA 深树 | ZHA 宽树 | MSA |
|---|---|---|---|---|
| AIME 2026 | 93.1 | 91.2 | 90.8 | 91.7 |
| SWE-bench Verified | 67.4 | 67.4 | 68.4 | 63.6 |
| Terminal-Bench 2.1 | 49.9 | 46.7 | 53.3 | 46.1 |
| MMLU-Pro | 84.9 | 85.3 | 85.2 | 85.3 |
| GPQA Diamond | 84.8 | 85.0 | 85.0 | 83.1 |
| RULER-13 (256K) | 96.0 | 93.3 | 96.2 | 77.1 |
| LongBench v2 (thinking) | 58.0 | 63.4 | 62.4 | 49.3 |
Source: arXiv 2610.42112, Figure 5. All numbers self-reported by Zyphra.
来源:arXiv 2610.42112,图 5。所有数据均由 Zyphra 自行报告。
The biggest gap is on retrieval. MSA drops to 77.1% on RULER-13, while both ZHA trees stay above 93%. On LongBench v2, the deep tree and MSA read similar key shares (1.1% vs 1%). The deep tree scores 14.1 points higher.
最大差距出现在检索任务上。MSA 在 RULER-13 上降至 77.1%,而两种 ZHA 树均保持在 93% 以上。在 LongBench v2 上,深树和 MSA 读取的关键份额相似(1.1% vs 1%),但深树的得分高出 14.1 分。
Across 28 tree geometries, RULER accuracy held steady when attending to 10 to 30% of keys. At fixed compression, deeper trees kept accuracy at higher sparsity. A 4-parameter model predicts RULER accuracy from geometry with 1.44-point RMSE.
在 28 种树结构中,当关注 10% 到 30% 的关键项时,RULER 准确率保持稳定。在固定压缩率下,更深的树在更高稀疏度下保持了准确率。一个 4 参数模型能以 1.44 点的 RMSE 从树结构预测 RULER 准确率。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力