BF1: A Causal Dyadic Sparse-Attention Retrofit for Efficient Long-Context Transformers
BF1: A Causal Dyadic Sparse-Attention Retrofit for Efficient Long-Context Transformers
BF1:一种用于高效长上下文 Transformer 的因果二元稀疏注意力改进方案
Abstract: Dense causal attention remains expensive at long context even when implemented with highly optimized exact kernels. We study BF1, a deterministic block-aligned dyadic sparse-attention route that combines a small exact local neighborhood, a global first block, and logarithmically spaced historical blocks.
摘要: 即使在采用高度优化的精确内核实现时,密集因果注意力在处理长上下文时依然代价高昂。我们研究了 BF1,这是一种确定性的、块对齐的二元稀疏注意力路径,它结合了小范围的精确局部邻域、全局首块以及按对数间隔排列的历史块。
The route is related to prior log-sparse and dilated attention patterns; our contribution is a correctness-gated pretrained-model retrofit, a matched topology-control study, and a systems characterization that connects per-layer sparsity to whole-model latency. For fixed block width, every converted layer uses O(n log n) selected token interactions and has O(log n) graph communication depth.
该路径与先前的对数稀疏(log-sparse)和膨胀(dilated)注意力模式相关;我们的贡献在于提供了一种经过正确性验证的预训练模型改进方案、一项匹配的拓扑控制研究,以及一项将层级稀疏性与整个模型延迟联系起来的系统表征。在固定块宽度的情况下,每个转换后的层使用 O(n log n) 的选定 Token 交互,并具有 O(log n) 的图通信深度。
On an NVIDIA RTX PRO 6000 Blackwell GPU, an optimized BF16 implementation crosses dense attention between 2K and 4K tokens and reaches a 10.91x per-layer prefill speedup at 32K. Retrofitting eight of 28 Qwen3-0.6B attention layers lowers warm whole-model time to first token by 7.7%, 11.3%, and 15.3% at 8K, 16K, and 32K, respectively, while the remaining dense layers keep the complete model asymptotically quadratic.
在 NVIDIA RTX PRO 6000 Blackwell GPU 上,优化的 BF16 实现方案在 2K 到 4K Token 之间超越了密集注意力,并在 32K 长度下实现了 10.91 倍的单层预填充加速。通过对 Qwen3-0.6B 模型 28 层注意力层中的 8 层进行改进,在 8K、16K 和 32K 长度下,模型预热后的首个 Token 生成时间分别降低了 7.7%、11.3% 和 15.3%,同时剩余的密集层确保了整个模型在渐近意义上仍保持二次复杂度。
Under a matched 1,000-step, 16.384M-token adaptation protocol, BF1 ranks first across three training seeds: mean report perplexity is 1.68639 versus 1.69154 for a matched static-random nonlocal graph, 1.69258 for dense continued training, and 1.81505 for equal-budget local sliding. At seed 1234, the packed-report paired interval places Dense-CT 0.3169-0.4055% above BF1 and static-random graph 17 0.2441-0.3642% above BF1.
在匹配的 1,000 步、16.384M Token 的适配协议下,BF1 在三个训练种子中均排名第一:其平均报告困惑度(perplexity)为 1.68639,而匹配的静态随机非局部图为 1.69154,密集持续训练为 1.69258,等预算局部滑动窗口为 1.81505。在种子 1234 下,打包报告的配对区间显示 Dense-CT 比 BF1 高出 0.3169-0.4055%,静态随机图比 BF1 高出 0.2441-0.3642%。
These results establish BF1 as a reproducible sparse operator and selective retrofit primitive with real long-context systems value. This paper evaluates numerical correctness, selected-interaction scaling, kernel performance, partial-model inference, and matched next-token language modeling.
这些结果确立了 BF1 作为一种可复现的稀疏算子和选择性改进原语的地位,并证明了其在长上下文系统中的实际价值。本文评估了数值正确性、选定交互的扩展性、内核性能、部分模型推理以及匹配的下一个 Token 语言建模效果。