cmHC: Balancing Stream Mixing in Hyper-Connections via Geometric Contraction
Organizations: Xingchen AGI Lab, China Telecom · The Hong Kong University of Science and Technology (Guangzhou) · Harbin Institute of Technology (Shenzhen) · Huawei Technologies Co., Ltd.
Abstract
Manifold-constrained Hyper-Connections (mHC) extends residual connections to multiple streams and stabilizes residual propagation by constraining stream-mixing residual matrices to the Birkhoff polytope, the set of doubly stochastic matrices. In this work, we investigate how to effectively mix residual streams within the Birkhoff polytope. We reveal a mixing trade-off: when under-mixed residual matrices stay close to the vertices of the Birkhoff polytope, hyper-connections will degenerate into a set of nearly independent streams; when over-mixed residual matrices are concentrated around the uniform barycenter of the polytope, streams will become less distinguishable from each other. We theoretically validate our findings by bounding the cumulative residual mixing, stream difference and gradient difference of mixing coefficients across layers. Motivated by these findings, we propose Contraction for Manifold-Constrained Hyper-Connections (cmHC), an exact doubly stochastic method which geometrically contracts the Birkhoff polytope toward its interior. This contraction mitigates under-mixing by forcing the residual matrices to explore deeper into the polytope, with a provable stream mixing bound and no new parameterization. Moreover, we apply a moderate contraction at the shallow layers to prevent over-mixing, enabling stable gradient propagation on extremely large-scale model pretraining. Extensive experiments across dense and mixture-of-experts models at various parameter scales demonstrate the effectiveness and scalability of cmHC. We also develop fused operators for cmHC on Ascend NPUs, reducing hyper-connection execution latency by up to 44.8%.
Figures & tables
| Input | Total latency ( s) | Speedup | Reduction | |
| mHC | mHC | |||
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | 6B-MoE | 300B-MoE |
| Transformer blocks | 28 | 48 |
| Hidden size | 2,048 | 7,168 |
| Dense feed-forward width | 5,632 | 18,432 |
| Initial dense blocks | 2 | 3 |
| MoE layers | 26 | 45 |
| Attention heads | 16 | 128 |
| Setting | 6B-MoE | 300B-MoE |
| Optimizer | AdamW | Muon |
| Learning rate after warmup | ||
| Warmup steps | 2,000 | 200 |
| Schedule after warmup | Constant | Constant |
| Configured training steps | 71,500 | 2,000 |
| Global batch size | 512 | 4,096 |
| Design consideration | Kernel realization | Intended effect |
| Heterogeneous arithmetic | Dense projections on cube cores; reductions, nonlinearities, and scale-accumulate paths on vector cores | Match arithmetic granularity to the core type |
| Small stream dimension | Use vector scaling, accumulation, and reduction for Post mixing | Avoid GEMM setup, padding, and format conversion for tiny matrices |
| Limited on-chip storage | Tile token and hidden dimensions; retain small coefficients and accumulators in Unified Buffer (UB) | Increase on-chip reuse within the UB capacity |
| Global-memory traffic | Fuse common-input operations; select ND/NZ workspace layouts at vector–cube handoffs; selectively bypass L2 for one-pass tensors | Reduce intermediate traffic, layout conversion, and cache pollution |
| Mixed-precision execution | Keep activations in BF16/FP16 and coefficients and accumulators in FP32 | Reduce bandwidth while preserving coefficient accuracy |
| Launch and scheduling overhead | Produce all outputs of each Pre or Post direction in one launch | Amortize launch cost and avoid repeated state scans |
| Tensor | Role | Shape | Data type |
| Multi-stream input | BF16/FP16 | ||
| Projection weight | FP32 | ||
| Group-wise scale | FP32 | ||
| Projection bias | FP32 | ||
| Contracted permutation matrix | FP32 | ||
| Aggregated sublayer input | BF16/FP16 |
| State | Shape | Data type | FP32 values/token |
| Inverse RMS factor | FP32 | 1 | |
| Projection output | FP32 | 32 | |
| Pre coefficients | FP32 | 4 | |
| Post coefficients | FP32 | 4 | |
| Residual coefficients | FP32 | 24 | |
| Total | – | FP32 | 65 |
| Input | Fwd latency ( s) | Fwd speedup | Bwd latency ( s) | Bwd speedup | ||
| mHC | mHC | mHC | mHC | |||
| Input | Fwd latency ( s) | Bwd latency ( s) | Total latency ( s) |
| 109.32 | 654.17 | 763.49 | |
| 160.20 | 1,180.29 | 1,340.49 | |
| 993.84 | 2,227.63 | 3,221.47 |
| Input | Fwd latency ( s) | Fwd speedup | Bwd latency ( s) | Bwd speedup | ||
| Ours | MindSpore | Ours | MindSpore | |||