Figure 1:Declarative Attention (DA) lets a model control its own attention span. (Prompt) A system instruction, long context information divided into segments that we refer to as "magic chunks", the user's question, and the DA instruction. (Model Response) The model freely alternates between three modes: <global> navigates the full context, <focus> reasons upon the named chunk, and <local> reasons upon the information accumulated in the response so far. (Declarative Attention Mask) A segment-level attention mask is derived from the model response text based on the DA syntax. DA needs no auxiliary scorer and runs on off-the-shelf models with no training.
中文解读:图中给出一个 25,466 token 的真实 prompt。模型先用 R1(<global>) 全局导航,定位到 Magic Chunk 1 含有 SFT 章节;再用 R2(<focus>) 只读取第 1 个分段,提取出"15K 数学答案 + 1.5K 对话"这一事实;最后用 R3(<local>) 完全不看上下文,只在自己已写出的响应里做加法得到 16,500。掩码矩阵的三行分别对应这三步:全局步读全部 A、B1…B12、C、D、R1(0% 缩减);聚焦步只读 A、B1、C、D 和已有响应(3,435 个 prompt token,86.5% 缩减);局部步连上下文分段都不读(1,124 个 prompt token,95.6% 缩减)。脚手架(系统指令 A、问题 C、指令 D)在任何模式下都保持可见。
与这种穷举式读取形成对照的是:大量实证研究表明注意力权重其实高度集中在上下文的极小部分(Child et al. 2019;Zhang et al. 2023;Tang et al. 2024),而且稀疏模式每步都在漂移。难点在于——真实的注意力分数只有算完整个注意力矩阵才知道,想"先挑出重要的 token 再算注意力"在逻辑上是先有鸡还是先有蛋。已有工作绕过这个死结的两条路线,论文都指出了其软肋:
<global>
I need the founding year and the IPO year. The company history in Magic Chunk 2 should state the founding.
</global>
<focus magic_chunks="2">"Acme Corp was founded in 2003 in San Jose."</focus>
<global>
The IPO year is still missing. Magic Chunk 7 covers Acme's financial milestones.
</global>
<focus magic_chunks="7">"Acme Corp went public on the NYSE in 2011."</focus>
<local>2011 - 2003 = 8 years.</local>
<answer>8 years</answer>
Table 1:The benchmark suite spans 15 long-context sources, from short documents to million-token code repositories. We group the sources into two categories, single-span retrieval/reasoning and multi-span reasoning, drawing on synthetic and original QA from RULER, LongBench v1/v2, LooGLE, and ZeroScrolls.
中文解读:15 个来源中 11 个用原始 QA,其余 4 个用 Gemini-3-Flash 生成合成 QA(改善标注质量或扩展任务覆盖)。上下文长度差异巨大——RULER 针堆 9–11.5K,LBv2/code_repo 平均 1071K。每个来源固定种子抽最多 128 例,超长样本(超 244K)剔除,同一模型下三种方法用完全相同的样本,保证公平。
Figure 7:Agreement between local and frontier LLM judges. Per-sample accuracies from the local Qwen-3.5-4B judge closely match those from the frontier Gemini-3.1-Pro judge across 15 long-context QA sources, two backbone models, and three inference methods.
中文解读:横轴 Gemini-3.1-Pro、纵轴 Qwen-3.5-4B,每个点是"15 来源 × 2 骨干 × 3 方法"组合的准确率。所有点紧贴对角线,说明本地小裁判可以放心地承担全部主实验打分——这是整个评测体系的可信度基石。
Table 9:Judge agreement between local judge (Qwen-3.5-4B) and frontier judge (Gemini-3.1-Pro). Per-benchmark accuracies (%) from the two judges on a stratified validation sample of 2993 responses.
中文解读:逐基准看,两裁判的准确率差大多在 ±1pp 内,最大的分歧也不过 −3.27pp(shortdep_cloze)与 +4.23pp(niah_single_2);总体 85.67% vs 85.80%,几乎重合。加权 kappa 0.940,支持用本地裁判完成全部主实验的准确率报告。
Table 2:DA reduces attention cost with a 1–3pp average accuracy drop. Across 15 long-context tasks, DA reduces total average attended tokens by 52.0% on Gemma-4-31B and 31.1% on Qwen-3.6-27B, with average accuracy drops of 1.27pp and 2.75pp respectively. DAnm represents the DA ablation without custom attention masking.
中文解读:表格按"单跨度检索/推理"与"多跨度推理"分两块,每格给出 Vanilla/DAnm/DA 三臂的准确率与注意力 token(背景色标出读取量的最好/居中/最差)。亮点:Gemma 在 15 项中 7 项持平或反超 vanilla(longdep_qa +3.1pp),Qwen 5 项(code_repo +5.6pp);绝对节省最大的正是最长上下文任务——code_repo 省 41.8M(Gemma)/52.0M(Qwen),dialogue_history 省 22.1M/39.1M。短板:多跨度类目的平均掉分比单跨度大(Gemma 2.28pp vs 0.78pp;Qwen 3.59pp vs 2.34pp),且 Qwen 在 qmsum 等五个来源上读取量反而超过 vanilla(其更长的生成部分抵消了每步节省)。
Figure 2:DA's efficiency comes from attention masking rather than shorter generation. Accuracy, decode steps, and attended tokens for Vanilla, DA, and DAnm on the two headline models, each normalized to that model's vanilla.
中文解读:(a) 三臂准确率几乎持平(DA 掉 1–3pp)。(b) DA 和 DAnm 都比 vanilla 多跑约 15–35% 的解码步(Gemma 135%、Qwen 131% / 128%、116%)——这是零样本协议让模型"边导航边写"的副产品。(c) 尽管步数更多,DA 的注意力读取远低于 vanilla(Gemma 48%、Qwen 69%);而不掩码的 DAnm 反而多读(166%、129%),因为它的额外步数每步都是全量注意力。结论一目了然:效率全部来自掩码,而不是生成变短。
Figure 4:DA holds accuracy near vanilla while its absolute token saving grows with context length. All 15 sources are pooled and binned by context length on Gemma-4-31B.
中文解读:(a) 相对精度:DA(实线)在 32K 内与 vanilla 几乎重合,最长桶滑到约 96%;DAnm(虚线)没有下滑——长上下文精度代价归因于掩码。(b) 相对 vanilla 的绝对读取差:DA 从短桶约 −1M 一路扩大到最长桶约 −21M(负=节省),而 DAnm 的开销同向增长(正=多读)。
Figure 10:DA's per-step masking saves a roughly constant fraction of tokens across context length. The same Gemma-4-31B pooling as Figure 4b, normalized to vanilla rather than shown as an absolute delta.
中文解读:DA(下线)在每个桶都稳定在 vanilla 的 50–64%;DAnm(上线)始终高于 vanilla。与 Figure 4b 的绝对视角合起来读:节省是一个稳定比例乘上一个随长度增长的总数,因此上下文越长,DA 的绝对收益越大。
Figure 8:On Qwen, DA's long-context accuracy and token savings erode more than on Gemma. Counterpart to Figure 4, on Qwen-3.6-27B.
中文解读:Qwen 的长上下文精度下滑比 Gemma 略多(最长桶约 92%),token 节省在长上下文端收缩(DA 曲线向 vanilla 回升,DAnm 则飙到远高于 vanilla)。原因不是掩码失效,而是模式组合——见图 9。Figure 9:Qwen matches Gemma's per-token savings but shifts more into global mode at long context. Counterpart to Figure 5, on Qwen-3.6-27B.
中文解读:(a) Qwen 的 global 模式 token 占比随上下文增长到最长桶约 55%(Gemma 约 45%);(b) 但每 token 节省与 Gemma 相当:focus/local 分别省 74–98% / 87–99%。也就是说,掩码机制本身两家一样好,差别在模型自发选择的"导航开销"大小——这是零样本激发的策略差异,作者认为可以用后训练优化(第 8 节)。
规模化一节的双重含义:对"模型规模"这条轴,DA 的精度代价随规模收敛(29%→99%),大模型几乎是免费的午餐;对"上下文长度"这条轴,DA 的绝对节省随长度放大(−1M→−21M)。两条轴恰好都是业界正在Scaling 的方向——这是论文对 DA 前景最有力的一组论据。
Table 3:Estimated decode wall-clock time on an optimized disaggregated inference setup. Per-response decode cost for each model and arm on a single B200 accelerator in bf16, summed over the generation and averaged across the 15 tasks, at MFU 40% for the compute-bound matmuls and MBU 70% for the memory-bound reads.
中文解读:vanilla 下全局内存读取占解码时间的 73%(Gemma,196.5/269.1 ms)与 86%(Qwen,263.8/306.2 ms)——这就是 DA 的杠杆所在。DA 下:全局读取 1100 GB→528 GB(Gemma)、1477 GB→1017 GB(Qwen),总墙钟降到 0.71× 与 0.77×。注意 matmul 和局部内存反而略涨(步数多了 35%/31%),被全局读取的下降盖过。两家模型的"漏损"不同:Qwen 的 GDN 状态只有 78.45 MB(占 DA 注意力时间 5%),节省几乎无损穿透;Gemma 的 SWA 地板横跨 50 层、838.9 MB(占 42%),把总节省封了顶。
Table 4:Per-model constants for the wall-time decomposition. Active params P, global attention layers L_global, KV bytes per token b_kv, fixed per-step local read s_local, and the local mechanism, each following the published configuration in bf16.
中文解读:每 token KV 字节 $b_{\text{kv}}$ 的公式是 $2 \times L_{\text{global}} \times n_{\text{kv}} \times d_{\text{head}} \times 2$(前一个 2 计 K 与 V,后一个 2 是 bf16 字节)。Gemma-4-31B:10 个全局层、81,920 B/token;Qwen-3.6-27B:16 个全局层、65,536 B/token。
Table 5:Trace inputs (macro-averaged over the 15 tasks). Decode-step count D and attended-token total A, measured directly from the generated responses of each arm.
中文解读:Gemma:vanilla 332 步 / 13.43M token → DA 448 步 / 6.45M(步数 +35%,读取 −52%);Qwen:573 / 22.54M → 752 / 15.52M(步数 +31%,读取 −31%)。这两个实测值代入三笔账公式即得 Table 3。
Figure 5:DA spends most tokens in cheap modes, with larger savings at longer contexts. Results on Gemma-4-31B. (a) Token share by mode across context-length buckets; <focus> and <local> account for about 73% of generated tokens, and <global>'s share rises at the longest contexts. (b) Per-token attention saved relative to vanilla.
中文解读:(a) global 占比随上下文变长上升到最长桶约 45%,封顶了那里的总节省;(b) focus 每步省 76→98%、local 省 88→99%,且上下文越长省得越多——focus 的增幅尤其陡。这说明 DA 的收益天然随长上下文任务与长程任务的Scaling 放大。global 步贡献了 DA 超过 80% 的注意力读取,是未来优化的靶子(比如用"上下文内索引"代替全量 survey)。
Figure 6:DA focus adherence improves with model size. (a) Focus success rate, the fraction of focus calls that parse to a valid chunk reference, rises toward 100% as the backbone grows in both families; the smallest model (Gemma-4-E4B, 58%) is the clear outlier, consistent with its accuracy collapse in Figure 3. (b) Focus attempts per response show no clear trend with model size.
中文解读:(a) 的 E4B 58% 与 Figure 3 的 29% 精度崩塌互为印证——小模型的崩塌大部分是"跟不上协议"而非"不会推理";(b) 尝试次数全员 1.4–1.9,说明规模改善的是遵守质量而非使用频度。
诚实的失败案例:六种任务上的两种结构性失配
论文没有回避失败场景(Appendix D.4)。15 个主基准之外有六类来源 DA 处理不好,作者把它们归为两种与三模式分解的结构性失配(而非机制弱点)——注意:即便在这六个来源上,DA 的每步注意力依然下降 39–67%:
Table 10:DA failure cases on Gemma-4-31B. The six sources where DA fails to preserve accuracy or fails to reduce attended tokens, grouped by the two structural failure modes. The cost is either accuracy (cluster 1: 84.2→58.8% mean) or attended-token inflation (cluster 2: 17.8→21.2 M/sample), even though per-step attention still falls on every source.
中文解读:第一类:证据被分段摧毁。cwe 需要跨全部分段的全局计数,structured_data 的表格被切散——<focus> 只看被点名的分段,信息进不来,精度从 84.21 崩到 58.84(即便读取还降了)。第二类:输出长度随文档增长。fwe 词频枚举、summ_screen_fd 逐段摘要、book_sum_sort 全文排序、in_context_learning 逐例推理——输出单位随文档伸缩,解码步数撑爆总量(17.84M→21.20M)。作者的修法:第一类靠"结构感知分段"(保表格完整)与 map-reduce 式逐段扫描+脚手架累积;第二类把长输出路由进 <focus> 以保持每步有界,或干脆用 SFT/RLVR 教模型这两种分解策略。
为什么这六个没进主基准?它们要么被基准自带的 prompt 明令禁止中间推理("只给答案,不要输出其他文字"——直接中和 DA 依赖的零样本脚手架),要么属于上述结构性失配。这个筛选是公开声明的(Appendix D.4),编者认为透明度合格,但读者评估"52% 节省"的外推范围时应记住:输出随文档伸缩的任务不在覆盖内。
Table 6:KV bytes per context token, as of August 2026. Stored bytes are what a context token occupies across the global attention layers, and the O(N) read is what one decode step must read per context token.
中文解读:全注意力模型"存储量 = 每步读取量",两者重合,跨度高达 13.8–254.0 KB/token(MiniMax-M2.7 以 62 层全注意力 + GQA 8 kv 头冠绝全场);索引器式稀疏设计则把两者撕开 6.6–33 倍——每步只对索引键做 O(N) 扫描(0.35–2.77 KB/token),另读固定 top-k。MiniMax-M3 是例外(20.7 KB):60 层里还有 3 层全注意力。这张表也定义了 DA 的用武之地:凡是 O(N) 读取仍是"大头"的架构,声明式掩码就有杠杆。
Table 7:Roofline decode decomposition at a 1M-token context. One decode step on a single B200 at MFU 40% and MBU 70%, with each model charged at the KV dtype its vendor's serving recipe specifies.
中文解读:全局读取在 1M 上下文下动辄十几毫秒,而 matmul 只有 0.014–0.232 ms——差两三个数量级。缩进行是"不加厂商配方时的 bf16 对照"(Qwen3.8-Max、Kimi-K3),换了精度也不改变分组区间。结论:在 1M 上下文,注意力读取仍是解码的主导成本,DA 声明的节省落在实处。
Table 8:Attention share against context length and against the utilization assumptions. The left block holds MFU and MBU fixed and varies N, and the right block holds N at 1M and takes the two corners of the reported utilization ranges.
中文解读:左块固定利用率、变上下文:1M → 244K → 128K,各模型份额逐级下滑,索引器组掉得最快(如 DeepSeek-V4-Pro 66.55%→32.68%→20.30%)。右块固定 1M、扫利用率区间的两个角:全注意力组几乎不动,索引器组最大波动 14.4 分(DeepSeek-V4-Pro)。整张表说明结论"注意力主导"对利用率稳健、对上下文长度敏感。