# Horizontal Contact Neural ODE

- ID: 565
- Canonical URL: https://synthcore.org/idea/565/horizontal-contact-neural-ode
- API JSON: https://synthcore.org/api/idea/565.json
- API Markdown: https://synthcore.org/api/idea/565.md
- Verification status: unverified
- Source: [arXiv:2607.07966](https://arxiv.org/abs/2607.07966)
- Category: dynamics
- Solves: stability, accuracy, sample-efficiency
- ML areas: ssm, training-dynamics, world-model
- Math tags: differential-geometry, geometry, convex-analysis, dynamical-systems
- Ratings: usefulness 5/10; difficulty 6/10; novelty 7/10

## Idea description

Replace an unconstrained latent ODE vector field with a contact-Hamiltonian flow whose velocities lie in a horizontal distribution spanned by a small set of vector fields. Couple the latent state to a scalar energy or confidence variable through a strictly decreasing value-dependent Lagrangian, giving expressive but dissipative dynamics rather than unrestricted feature drift.

## Mathematical statement

The paper defines horizontal velocities v in a distribution \mathcal{D}\subset TM and a subriemannian length \ell(\gamma)=\int_a^b\|\dot\gamma(t)\|dt for horizontal absolutely continuous curves. Its Lagrangian L(v,u) is uniformly superlinear, meaning that for every k\ge 0 there is C(k) with L(v,0)\ge k\|v\|+C(k), strictly convex in v with \partial^2_{vv}L(v,u)(w,w)\ge\kappa\|w\|^2 for \kappa>0, and bounded monotone in the scalar u with -\lambda\le\partial_uL(v,u)<0. The associated contact Hamiltonian is H(p,u)=\max\{p(v)-L(v,u):v\in\mathcal{D},\pi(v)=\pi^*(p)\}, where p is a cotangent vector and u is a scalar. For implementation, represent \mathcal{D}_x by m vector fields X_i(x) assembled as a matrix X(x)\in\mathbb{R}^{d    imes m}, write v=X(x)a, and use the explicit convex Lagrangian L_    heta(a,u)=\frac12a^    op A_    heta a+\rho\log(1+e^{-u}), with A_    heta\succ0 and \rho>0. For q=X(x)^    op p, its Legendre transform is H_    heta(x,p,u)=\frac12q^    op A_    heta^{-1}q-\rho\log(1+e^{-u}). The adapted contact flow uses \dot x=\partial_pH, \dot p=-\partial_xH-(\partial_uH)p, and \dot u=p^    op\partial_pH-H. Positive definiteness of A_    heta gives strict convexity; the softplus term gives -\rho\le\partial_uL<0 and prevents uncontrolled scalar feedback.

## Key formulas

- $$\ell(\gamma)=\int_a^b\|\dot{\gamma}(t)\|\,dt$$
- $$-\lambda\leq\partial_{u}L(v,u)<0,\qquad \partial_{vv}^{2}L(v,u)(w,w)\geq\kappa\|w\|^{2}$$
- $$H(p,u)=\max\{p(v)-L(v,u):v\in\mathcal{D},\ \pi(v)=\pi^{*}(p)\}$$
- $$L_\theta(a,u)=\frac12a^\top A_\theta a+\rho\log(1+e^{-u}),\quad q=X(x)^\top p,\quad H_\theta(x,p,u)=\frac12q^\top A_\theta^{-1}q-\rho\log(1+e^{-u})$$

## Implementation notes

Integrate this module at the latent-dynamics component of a neural ODE, continuous-time SSM, or world model. Let x\in\mathbb{R}^d be the latent state, p\in\mathbb{R}^d an auxiliary cotangent state, and u\in\mathbb{R} a scalar energy or confidence state. Choose m\ll d vector fields X_i(x); they can be fixed from a known manifold or produced by a small neural network, with X(x)=[X_1(x),...,X_m(x)]. Parameterize A_    heta=R_    heta R_    heta^    op+\epsilon I so it is positive definite. At every ODE step compute q=X(x)^    op p, h=0.5*q^T*solve(A,q)-rho*softplus(-u), then compute dx=X(x)*solve(A,q). Obtain dp and du by automatic differentiation of h: dp=-grad_x(h)-(partial_u h)*p and du=p^T*dx-h. Use an adaptive RK solver or fixed-step RK4, and feed x_T and u_T to the task head. The paper’s mathematical guarantees used directly are horizontal motion, strict convexity from A\succ0, superlinear quadratic control cost, and bounded negative scalar derivative; derivatives and numerical trajectories are computed by autodiff. Initialize p with an encoder output and u with a learned scalar or zero. First run a cheap ablation on latent trajectory prediction for a synthetic Heisenberg-group or sphere dataset with known horizontal vector fields, comparing an MLP-ODE, a standard Hamiltonian neural ODE, and this module at matched parameters and function evaluations. Measure one-step error, 50-step rollout error, gradient norm variance, and held-out likelihood. A successful signal is lower long-horizon error and fewer exploding trajectories at equal function evaluations; a second test should check whether learned horizontal rank m<d improves sample efficiency rather than merely adding parameters.

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
