xHC: Expanded Hyper-Connections
arXiv · HuggingFace · ▲26
摘要(原文)
Hyper-Connections (HC) expand the residual stream of Transformers into N parallel streams, providing a form of memory scaling beyond model width and depth. Manifold-Constrained HC (mHC) stabilizes this formulation at scale. The large gains from N{=}1 to N{=}4 suggest residual-stream expansion as a promising scaling axis. However, existing HC-family methods typically stop at N{=}4. Our experiments reveal why: scaling mHC beyond this point yields diminishing performance gains and rapidly increasing training cost. We attribute this limitation to two bottlenecks: insufficient write-back information for an expanding number of streams and residual-mixing generation whose cost scales cubically with N. To address both bottlenecks, we propose xHC (Expanded Hyper-Connections), the first HC-family method to achieve meaningful expansion beyond N{=}4. xHC combines temporal feature augmentation for richer write-back with a sparse residual-stream architecture that updates only k=4 of the N=16 streams while retaining dense access to the full residual state. Across 18B and 28B MoE models, xHC delivers strong and consistent downstream improvements. On an 18B MoE model, xHC improves the average downstream score by 4.0 points over mHC, while adding only modest training FLOPs over the vanilla baseline. Scaling-law experiments show that the vanilla and mHC require 1.50times and 1.19times the compute of xHC, respectively, to reach the same loss. Practical large-N training also requires controlling memory traffic from the expanded residual state. We therefore introduce xHC-Flash, which reduces the per-sublayer memory traffic from 73.5C to 40C, comparable to the 34C required by mHC at N{=}4, while retaining the gains of full xHC. Together, xHC and xHC-Flash make large-N residual-stream expansion effective and practical for LLM pre-training.
摘要(中译)
超连接(Hyper-Connections,HC)将Transformer的残差流扩展为N个并行流,提供了一种超越模型宽度和深度的内存扩展形式。流形约束超连接(Manifold-Constrained HC,mHC)在大规模场景下稳定了这种公式化方法。从N=1到N=4的显著收益表明残差流扩展是一个有前景的扩展轴。然而,现有的HC系列方法通常止步于N=4。我们的实验揭示了原因:将mHC扩展到这个点之外会导致性能收益递减和训练成本迅速增加。我们将这一限制归因于两个瓶颈:对于不断扩展的流数量,回写信息不足;以及残差混合生成的成本随N呈三次方增长。为了解决这两个瓶颈,我们提出了xHC(扩展超连接),这是第一个在N>4时实现有意义扩展的HC系列方法。xHC结合了时间特征增强以获得更丰富的回写,以及一种稀疏残差流架构,该架构仅更新N=16个流中的k=4个流,同时保留对完整残差状态的密集访问。在18B和28B的混合专家(Mixture of Experts,MoE)模型上,xHC带来了强大且一致的下游改进。在一个18B的MoE模型上,xHC将平均下游分数比mHC提高了4.0分,而相对于普通基线只增加了适度的训练浮点运算次数(floating-point operations,FLOPs)。缩放定律实验表明,普通方法和mHC分别需要比xHC多1.50倍和1.19倍的计算量才能达到相同的损失。实际的大N训练还需要控制来自扩展残差状态的内存流量。因此,我们引入了xHC-Flash,它将每个子层的内存流量从73.5C减少到40C,与N=4时mHC所需的34C相当,同时保留了完整xHC的收益。总之,xHC和xHC-Flash使大N残差流扩展在大型语言模型(Large Language Model,LLM)预训练中既有效又实用。
背景剖析
大语言模型(LLM)的核心架构长期依赖单一残差流传递信息,这种设计限制了模型对跨层信息的灵活控制能力。随着模型规模扩大,单纯增加宽度、深度或数据量已难以高效提升性能,需要新的扩展维度。Hyper-Connections(HC)技术通过并行残差流和可学习的混合矩阵,试图为模型增加"记忆容量",但现有方法在扩展到4个以上并行流时遇到瓶颈——性能提升骤减而计算成本激增。
具体来说,原有方法存在两个关键缺陷:首先,每个新增的残差流需要存储不同的层输出历史,但每层只能注入单一的写回信号,导致信息多样性不足;其次,计算成本随并行流数量呈立方级增长,因为需要从高维状态中预测混合系数。这使得扩展残差流成为"代价高昂的低效操作"。
本文提出的xHC(Expanded Hyper-Connections)通过双管齐下的方案解决了这些问题:一方面引入时间特征增强,在保持计算效率的同时为每个残差流提供更丰富的上下文信息;另一方面采用稀疏残差流架构,只激活少量流进行更新,大幅降低计算开销。这种设计既解决了信息多样性问题,又控制了计算成本,使得残差流扩展到16个甚至更多成为可能。
与前人工作相比,xHC的关键创新在于:1)首次实现超过4个并行流的有效扩展;2)将信息增强与计算优化解耦但又协同工作;3)不仅提升性能,还显著改善了扩展的性价比。实验表明,在18B参数的MoE模型上,xHC比现有方法mHC提升了4个下游任务分数,同时只增加了少量训练成本。这种技术突破使得残差流扩展真正成为LLM训练的有效扩展维度。






