给AI的注意力做减法,反而更聪明
大模型处理长文本时,每个词都要跟前面所有词打招呼,成本随长度平方级暴涨。现有省钱的招数是让AI先挑几个“重要”的词再看,但挑词的标准和最终答对题的目标是脱节的——就像考前划重点的人没看过真题。这篇论文把“挑词”和“答题”焊在一起训练:让AI在答题过程中自己摸索哪些词值得看,而不是照着老师给的答案背。结果在推理、长文档理解、智能体任务上都比老方法强,预算越紧优势越大。它不是你明天能用上的东西,但指向一个趋势:AI的效率优化正在从“省计算”转向“省得聪明”。
📄 原文摘要(英文)
Post-training attention sparsification reduces the quadratic cumulative attention cost of pretrained Transformers by selecting a small set of context units (tokens or blocks) for each query. Existing trainable methods usually use a lightweight selector to score context units, followed by hard Top-K selection that blocks gradients from the language modeling loss. Consequently, these methods commonly distill layer-wise dense attention distributions. Although this encourages the selector to rank context units by dense attention weights in the original model, the ranking is not directly aligned with their impact on predictions under a fixed attention budget (i.e., the number of attended context units per query), potentially wasting the limited budget on less useful units. To address this misalignment, we propose Simple Attention Sparsification (SAS), a gated sparse attention mechanism that optimizes context ranking end-to-end with the language modeling loss. The key idea is to inject the selector's continuous scores into attention logits during training, allowing the loss to update the selector through standard backpropagation. We identify several choices crucial for this simple design to work well in practice: placing the gate inside the attention softmax in log form, using normalized softmax gates to calibrate historical context against the always-retained current block, and preserving continuous selector scores so the model learns relative priorities rather than only hard selections. To support long-sequence training, we implement a memory-efficient Triton kernel that integrates SAS into FlashAttention-style computation. Across reasoning, long-context understanding, and agentic tasks, SAS consistently outperforms trainable sparse attention baselines across attention budgets, with especially large gains under tight budgets, demonstrating more effective context ranking for downstream tasks.