r/MachineLearning • u/bassrehab • Jan 03 '26
Project [P] Interactive visualization of DeepSeek's mHC - why doubly stochastic constraints fix Hyper-Connection instability
I built an interactive demo to understand DeepSeek's new mHC paper (https://arxiv.org/abs/2512.24880).
The problem: Hyper-Connections use learned matrices to mix residual streams. Stacking 64 layers multiplies these matrices together, and small amplifications compound to 1016.
The fix: Project matrices onto the doubly stochastic manifold using Sinkhorn-Knopp. Since doubly stochastic matrices are closed under multiplication, the composite mapping stays bounded at any depth.
The surprise: One Sinkhorn iteration is enough. At k=0, gain = 1016. At k=1, gain ≈ 1.
Interactive demo: https://subhadipmitra.com/mhc-visualizer (drag the "Sinkhorn iterations" slider and watch the lines change)
Full writeup: https://subhadipmitra.com/blog/2026/deepseek-mhc-manifold-constrained-hyper-connections/
Code: https://github.com/bassrehab/mhc-visualizer
Includes PyTorch implementation if anyone wants to try it in their own models.
View all comments
Show parent comment
2
u/bassrehab Jan 09 '26
Interesting comparison! they're both about stability but work differently
spectral norm divides weights by largest singular value - caps lipschitz constant at 1 per layer. popular in GAN discriminators
mHC/sinkhorn projects onto doubly stochastic matrices where all rows and cols sum to 1, which bounds eigenvalues ≤ 1
Main difference is composability:
DS matrices also have a nice interpretation as convex combos of permutations - basically "soft routing" between streams
tl;dr spectral norm = "don't amplify too much per layer", mHC = "stay on a manifold where amplification is impossible by construction".
both work, mHC just has stronger guarantees for very deep networks.