TransNormerLLM:一种基于改进 TransNormer 的更快更好的大语言模型
TransNormerLLM: A Faster and Better Large Language Model with Improved TransNormer
AI总结:
本文提出 TransNormerLLM,通过改进位置嵌入、Lightning Attention、门控机制、张量归一化及推理与并行方案,使线性注意力 LLM 在准确率和效率上超越 softmax 注意力模型,并验证了其扩展至 175B 参数的能力。
摘要:
我们提出了 TransNormerLLM,这是首个基于线性注意力的大语言模型(LLM),在准确率和效率两方面均优于传统的基于 softmax 注意力的模型。TransNormerLLM 由先前的线性注意力架构 TransNormer 演化而来,并进行了多项高级改进,包括位置嵌入、线性注意力加速、门控机制、张量归一化以及推理加速与稳定化。具体而言,我们使用 LRPE 结合指数衰减来避免注意力稀释问题,同时使模型能够保留 token 之间的全局交互。此外,我们提出了 Lightning Attention,这是一项前沿技术,在运行时间上将线性注意力加速超过两倍,并将内存使用量显著降低四倍。为了进一步提升 TransNormer 的性能,我们利用门控机制实现平滑训练,并采用一种新的张量归一化方案来加速模型,取得了超过 20% 的显著加速效果。此外,我们开发了一种稳健的推理算法,无论序列长度如何,都能确保数值稳定性和一致的推理速度,在训练和推理阶段均展现出卓越的效率。我们还为 TransNormerLLM 实现了高效的模型并行方案,使其能够在大规模集群上无缝部署,并便于扩展到更大规模的模型,即具有 175B 参数的 LLM。我们通过一系列消融实验验证了模型设计,并在自行收集的语料库上训练了规模为 385M、1B 和 7B 的模型。基准测试结果表明,我们的模型不仅能够与基于 Transformer 的最先进 LLM 的性能相媲美,而且速度显著更快。代码发布于:https://github.com/OpenNLPLab/TransnormerLLM。
英文摘要:
We present TransNormerLLM, the first linear attention-based Large Language Model (LLM) that outperforms conventional softmax attention-based models in terms of both accuracy and efficiency. TransNormerLLM evolves from the previous linear attention architecture TransNormer by making advanced modifications that include positional embedding, linear attention acceleration, gating mechanisms, tensor normalization, and inference acceleration and stabilization. Specifically, we use LRPE together with an exponential decay to avoid attention dilution issues while allowing the model to retain global interactions between tokens. Additionally, we propose Lightning Attention, a cutting-edge technique that accelerates linear attention by more than twice in runtime and reduces memory usage by a remarkable four times. To further enhance the performance of TransNormer, we leverage a gating mechanism for smooth training and a new tensor normalization scheme to accelerate the model, resulting in an impressive acceleration of over $20\%$. Furthermore, we develop a robust inference algorithm that ensures numerical stability and consistent inference speed, regardless of the sequence length, showcasing superior efficiency during both training and inference stages. We also implement an efficient model parallel schema for TransNormerLLM, enabling seamless deployment on large-scale clusters and facilitating expansion to even more extensive models, i.e., LLMs with 175B parameters. We validate our model design through a series of ablations and train models with sizes of 385M, 1B, and 7B on our self-collected corpus. Benchmark results demonstrate that our models not only match the performance of state-of-the-art LLMs with Transformer but are also significantly faster. Code is released at: https://github.com/OpenNLPLab/TransnormerLLM.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。