What is mHC (Manifold-Constrained Hyper-Connections)
mainmHC is a research implementation of the Manifold-Constrained Hyper-Connections (DeepSeek) as a drop-in variant of Hyper-Connections. It implements a layer update formula:
x_{l+1} = H_l^{res} x_l + H_l^{post,T} F(H_l^{pre} x_l, W_l)
Key mathematical constraints implemented include:
H_res: A doubly stochastic matrix (Birkhoff polytope) where entries are $\ge 0$ and rows/columns sum to 1, achieved via Sinkhorn-Knopp.H_pre,H_post: Non-negative mixing maps.
This implementation uses static per-layer matrices where H_res_logits are projected via Sinkhorn, and H_pre_logits/H_post_logits are mapped to non-negative weights (e.g., via softmax).