cmHC: Balancing Stream Mixing in Hyper-Connections via Geometric Contraction
Authors: Haowei He, Ziwen Zhao, Chenshuo Pan, Gang Lin, Zhihao Yang, Chao Wang, Xinzhang Liu, Kaidong Yu, Han Gao, Dongfang Li, Menglin Yang, Shuangyong Song, Yongxiang Li
Organizations: Xingchen AGI Lab, China Telecom · The Hong Kong University of Science and Technology (Guangzhou) · Harbin Institute of Technology (Shenzhen) · Huawei Technologies Co., Ltd.
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
Figure 1: Illustration of our geometric contraction and its effect on stream mixing. (a) Architecture of hyper-connections at layer l . Our method focuses on the hyper-connection module. (b) Two-dimensional projections of the Birkhoff polytope for n=3 , along with the sampled trajectories of layer-averaged residual matrices during training, ended at the star . Traditional methods like mHC-lite do not encourage an interior exploration of the polytope, so the residual matrices remain close to a permutation vertex; our moderate contraction encourages interior exploration, while a strong contraction may drive the residual matrices toward the uniform barycenter. (c) Layer-averaged residual matrices and cosine similarity distributions between streams for n=4 . A lower contraction coefficient λ indicates a stronger contraction.
Figure 2: The under-mixing phenomenon under different initializations. Left : L1∑l=0L−1Hlres at training steps 0 (initial state), 5k, and 10k. Across different initializations, L1∑l=0L−1Hlres keeps close to the initial permutation matrix, not only the identity. Right : entry distributions of mixing coefficients α . The coefficient assigned to the initialized permutation (“Init perm”) stays close to 1, while the majority of coefficients over all permutations (“All perms”) stays close to 0.
Figure 3: Cumulative residual matrix ∏l=0L−1Hlres′ and Dobrushin’s ergodicity coefficient τ under different λ and network depth L . Note that the matrices slightly deviate from exact doubly stochasticity because of the inference-time low-precision conversion.
Figure 4: Frobenius norms of stream differences ∥x~∥F over training steps.
Figure 5: Distributions of mixing coefficients α over the vertices of B4 (across all layers of nanoGPT-L). The 24 vertices are ranked by their α value. Curves indicate the medians. See Appendix E.4 for full results.
Figure 6: Loss gaps relative to c mHC and gradient norms (nanoGPT-S; OpenWebText).
Figure 7: Loss gaps relative to c mHC and gradient norms (6B- and 300B-MoE; FineWeb-Edu).
Input [B,S,n,D]
Total latency ( μ s)
Speedup
Reduction
c mHC
mHC
[1,4096,4,2048]
1,474.59
2,670.02
1.81×
44.8%
[1,4096,4,3584]
2,706.02
3,923.59
1.45×
31.0%
[1,4096,4,7168]
6,472.56
8,523.01
1.32×
24.1%
Table 3: Total latency of the complete fused c mHC and mHC operator pipelines on Ascend 910C, including both forward and backward Pre and Post operators. Better latency time is in bold .
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
Appendix
Table 4: Architecture settings for the large-scale experiments. Expert widths are intermediate dimensions. Model scales follow the experiment designations.
Setting
6B-MoE
300B-MoE
Optimizer
AdamW
Muon
Learning rate after warmup
10−5
2×10−4
Warmup steps
2,000
200
Schedule after warmup
Constant
Constant
Configured training steps
71,500
2,000
Global batch size
512
4,096
Appendix
Table 5: Training settings and completed training lengths. Token counts use the completed steps. A dash denotes a value not specified in the supplied configuration.
Figure 8: Loss gaps relative to c mHC and gradient norms (nanoGPT-M and nanoGPT-L; OpenWebText).
Figure 9: Full heatmaps of residual matrices ( c mHC , λ=0.97 , K=2 ; nanoGPT-L). Left : residual matrices Hlres for every l . Right : average and product of residual matrices, and cosine-similarity distribution between streams.
Figure 10: Full experiment results: distributions of mixing coefficients αl over the vertices of B4 for every l (nanoGPT-L). A purple (blue) background marks cases where the entropy H(αl) of c mHC is larger (smaller) than that of mHC-lite .
Figure 11: Comparative results with 6 residual streams (nanoGPT-S).
Figure 12: Fused-operator pipeline for c mHC . The backward path reverses the forward order and routes direct residual-path gradients from Post backward to Pre backward.
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 n=4 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
Appendix
Table 7: Design principles and their mapping to the target architecture.
Tensor
Role
Shape
Data type
Xl
Multi-stream input
[B,S,n,D]
BF16/FP16
Φ
Projection weight
[Q,nD]
FP32
s
Group-wise scale
[3]
FP32
b
Projection bias
[Q]
FP32
Pl′
Contracted permutation matrix
[R,n,n]
FP32
Hin
Aggregated sublayer input
[B,S,D]
BF16/FP16
Appendix
Table 8: Primary tensor interface of the fused c mHC Pre forward operator.
Figure 13: Three-stage data path of the fused c mHC Pre forward operator, including framework-side preparation of the contracted bases.
State
Shape
Data type
FP32 values/token
Inverse RMS factor
[T,1]
FP32
1
Projection output M
[T,32]
FP32
32
Pre coefficients
[T,4]
FP32
4
Post coefficients
[T,4]
FP32
4
Residual coefficients A
[T,24]
FP32
24
Total
–
FP32
65
Appendix
Table 9: Forward states reused by the fused c mHC Pre backward operator for n=4 .
Input [B,S,n,D]
Fwd latency ( μ s)
Fwd speedup
Bwd latency ( μ s)
Bwd speedup
c mHC
mHC
c mHC
mHC
[1,4096,4,2048]
266.70
1,017.50
3.82×
444.40
889.03
2.00×
[1,4096,4,3584]
485.96
1,217.54
2.51×
879.57
1,365.56
1.55×
[1,4096,4,7168]
1,168.57
2,255.84
1.93×
2,082.52
3,045.70
1.46×
Appendix
Table 10: Latency of the fused c mHC Pre and mHC Pre operators.
Input [B,S,n,D]
Fwd latency ( μ s)
Bwd latency ( μ s)
Total latency ( μ s)
[1,4096,4,2048]
109.32
654.17
763.49
[1,4096,4,3584]
160.20
1,180.29
1,340.49
[1,4096,4,7168]
993.84
2,227.63
3,221.47
Appendix
Table 11: Latency of the fused Post forward and backward operators used in the complete pipeline.
Input [B,S,n,D]
Fwd latency ( μ s)
Fwd speedup
Bwd latency ( μ s)
Bwd speedup
Ours
MindSpore
Ours
MindSpore
[1,4096,4,2048]
314.17
1,524.50
4.85×
620.95
3,042.44
4.90×
[1,4096,4,3584]
567.43
2,607.34
4.59×
1,259.12
5,455.29
4.33×
[1,4096,4,7168]
1,252.86
5,325.69
4.25×
3,517.94
11,119.79
3.16×
Appendix
Table 12: Latency of our fused Pre operator and the MindSpore primitive-operator composition.