arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.06554cs.CL
收藏

长上下文预训练与Lighthouse注意力

Long Context Pre-Training with Lighthouse Attention

Nous Research(Nous研究院)

Bowen Peng, Subho Ghosh, Jeffrey Quesnelle

AI总结:

本文提出Lighthouse注意力机制,通过分层选择策略实现高效长序列训练,减少计算复杂度,提升并行效率,并在训练后期恢复完整注意力模型,实验证明其在训练速度和最终损失上的优势。

摘要:

在极长序列长度下训练因果变换器受到标量点积注意力(SDPA)二次时间与内存复杂度的限制。本文提出Lighthouse注意力,一种仅用于训练的对称选择基 hierarchical 注意力算法,可包裹普通SDPA并易于在训练结束时移除。我们的分层选择也是梯度自由的,从而避免了复杂且可能低效的反向传播内核。我们的贡献有三:(i)一个亚二次分层预处理和后处理步骤,实现序列的自适应压缩与解压缩。(ii)一种对称压缩策略,同时池化查询、键和值,同时保持左到右因果性,显著提升并行性。(iii)一种两阶段训练方法,我们大部分时间使用Lighthouse注意力预训练,最后用短时间训练恢复完整注意力模型。我们进行了初步的小规模LLM预训练实验,结果表明,与全注意力训练相比,我们的方法在总训练时间和恢复阶段的最终损失上更优。完整代码可在:https://github.com/ighoshsubho/lighthouse-attention

英文摘要:

Training causal transformers at extreme sequence lengths is bottlenecked by the quadratic time and memory of scaled dot-product attention (SDPA). In this work, we propose Lighthouse Attention, a training-only symmetrical selection-based hierarchical attention algorithm that wraps around ordinary SDPA and can be easily removed towards the end of the training. Our hierarchical selection is also gradient-free, which exempts us from dealing with a complicated and potentially inefficient backward pass kernel. Our contribution is three-fold: (i) A subquadratic hierarchical pre- and post-processing step that does adaptive compression and decompression of the sequence. (ii) A symmetrical compression strategy that pools queries, keys and values at the same time, while preserving left-to-right causality, which greatly improves parallelism. (iii) A two stage training approach which we pre-train for the majority of the time with Lighthouse Attention and recover a full attention model at the end with a short training. We run preliminary small scale LLM pre-training experiments that show the effectiveness of our method compared to full attention training with all other settings matched, where we achieve a faster total training time and lower final loss after the recovery phase. Full code is available at: https://github.com/ighoshsubho/lighthouse-attention

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

↑