arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2605.28384cs.LG
收藏

Meta-Attention: 用于高效Transformer推理的贝叶斯逐Token路由

Meta-Attention: Bayesian Per-Token Routing for Efficient Transformer Inference

Knowledge Lab AG Zürich(苏黎世知识实验室)

Alan Ferrari

AI总结:

提出Meta-Attention框架,通过贝叶斯元控制器动态为每个token选择最优注意力策略(全softmax、线性或滑动窗口局部注意力),在几乎无开销下实现更优的计算-性能权衡。

摘要:

标准Transformer架构对所有token和序列位置统一应用单一注意力机制,而不考虑局部上下文或计算预算。我们提出Meta-Attention,一个通过贝叶斯元控制器动态将每个token路由到最合适的注意力策略(全softmax注意力、线性(核)注意力或滑动窗口局部注意力)的框架。与使用确定性或无先验学习路由的先前路由方法不同,元控制器将逐token机制选择视为在计算感知的Dirichlet先验下的后验推理:路由权重是通过证据下界(ELBO)目标训练的摊销变分后验q(alpha | x_t; phi)的输出,该目标联合编码任务性能和注意力机制成本。这种设计产生原则性的路由不确定性估计,控制软到硬的路由转换,无需临时负载平衡损失即可缓解路由崩溃,并在几乎无开销的情况下比确定性或无先验学习路由产生更好的计算-性能权衡。在Tiny LM基准上的第一阶段实证结果证实了核心预测:贝叶斯控制器的学习路由分布在硬路由下意味着归一化FLOP成本为25.1%,而无先验基线为59.3%(-34.2个百分点),并将路由熵从55.8%降低到43.3%(-12.5个百分点),表明Dirichlet先验防止了路由崩溃,而非贝叶斯模型默认使用全注意力。我们展示了贝叶斯架构、ELBO训练目标以及验证前向传播正确性、后验多样性和与无先验基线进行受控消融的第一阶段PyTorch原型。代码见:https://github.com/KFEAL/meta-attention

英文摘要:

Standard transformer architectures apply a single attention mechanism uniformly across all tokens and sequence positions, irrespective of local context or computational budget. We propose Meta-Attention, a framework that dynamically routes each token to the most appropriate attention strategy -- full softmax attention, linear (kernel) attention, or sliding-window local attention -- via a Bayesian Meta-Controller. Unlike prior routing approaches that use deterministic or prior-free learned routing, the Meta-Controller treats per-token mechanism selection as posterior inference under a compute-aware Dirichlet prior: routing weights are the output of an amortised variational posterior q(alpha | x_t; phi) trained with an Evidence Lower Bound (ELBO) objective that jointly encodes task performance and attention-mechanism cost. This design produces principled routing uncertainty estimates that govern the soft-to-hard routing transition, mitigates routing collapse without ad hoc load-balancing losses, and yields better compute-performance trade-offs than deterministic or prior-free learned routing at negligible overhead. Phase 1 empirical results on a Tiny LM benchmark confirm core predictions: the Bayesian controller's learned routing distribution implies a projected normalised FLOP cost of 25.1% under hard routing, vs. 59.3% for the prior-free baseline (-34.2 pp), and reduces routing entropy from 55.8% to 43.3% (-12.5 pp), demonstrating that the Dirichlet prior prevents routing collapse while the non-Bayesian model defaults to full attention. We present the Bayesian architecture, ELBO training objective, and a Phase 1 PyTorch prototype validating forward-pass correctness, posterior diversity, and a controlled ablation against a prior-free baseline. Code available at: https://github.com/KFEAL/meta-attention

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑