                            Geometric Contact Flows: Contactomorphisms for Dynamics and Control

where ∂H/∂s represents the damping coefficient of the dy-                 {z̄b (0)}b∈[1,B] , we integrate the latent dynamics to obtain
namics. Consequently, the +s term in Eq. 7b ensures the de-               the predicted latent trajectories {zb (t), t ∈ [0, tb ]}b∈[1,B] ;
pletion of the system energy and the convergence toward the               (3) We then map the predicted latent trajectories to the am-
attractor {q, p, s} = 0. Instead, the dynamics (7c) is suit-              bient space using the inverse contactomorphism φ−1        r (T ),
able for safety-critical scenarios requiring stopping the sys-            yielding {xb (t), t ∈ [0, tb ]}b∈[1,B] ; (4) Finally, we compute
tem near unsafe regions of the state space (N , η ′ ). By scal-           the estimation error in both spaces using the average loss,
ing all terms of the contact Hamiltonian with s, the energy                           B      tb 
H can reach zero while q and p remain non-zero, stopping                           1 X 1 X                             2
                                                                                ℓ=                wx x̄b (t) − xb (t) 2 +
the system before it reaches the attractor. Unsafe regions are                     B     tb t=0                                       (12)
                                                                                     b=1
here characterized by low values of the Lagrangian action s.                                                          2
                                                                                                                        
                                                                                                  wz z̄b (t) − zb (t) 2 ,
Contactomorphisms Design. While diffeomorphisms are
commonly used to align latent and target dynamics in first-               where wx and wz are weights balancing the ambient and
order systems, they fail to preserve the intrinsic structure of           latent space components. Typically, wx ≫ wz , as we focus
second-order systems, in particular the interplay between                 on capturing the ambient dynamics. However, the latent
conjugate variables encoded in the contact form. To address               error term acts as a useful regularizer, as shown in App. C.2.
this, we leverage contactomorphisms, which preserve η ′ and               Algorithm 1 in App. B.1 outlines the training phase.
thus maintain the latent space structure. The practical impli-
cations of this inductive bias are examined in the ablation               After training, predicting the ambient dynamics from an
study presented in App. C.1. A contactomorphism φ trans-                  initial point x0 involves mapping it to the latent space via
forms coordinates z from the latent space (N , η ′ ) into a new           the learned contactomorphism φr , integrating the latent dy-
set of coordinates x that describe the ambient space (M, η).              namics φg , and then mapping the result back to the ambient
As described in Sec. 3, we model this transformation as the               space via the inverse contactomorphism φ−1  r . Importantly,

flow φr (t) of a contact Hamiltonian system evaluated at                  integrating the latent dynamics does not require evaluating
time t = T ,                                                              the learned contactomorphism at every step. This enables ef-
                                                                          ficient long-horizon predictions using only a single forward
            z = φr (T )(x),      x = φ−1
                                      r (T )(z).               (9)        and inverse mapping. Formally, this process is expressed as
For expressivity, we implement this contact transformation                a composition of contact Hamiltonian flows,
as a composition of K sequential parametrized networks,                      x(t) = φ−1
                                                                                     r (T ) ◦ φg (t) ◦ φr (T )(x0 ), t ∈ [0, t1 ].    (13)
 φr (T ) = φrθK (τ ) ◦ · · · ◦ φrθk (τ ) ◦ · · · ◦ φrθ1 (τ ), (10a)
                                                                          Details on the physical interpretation of this composition
 φ−1        −1                  −1                  −1
  r (T ) = φrθ1 (τ ) ◦ · · · ◦ φrθk (τ ) ◦ · · · ◦ φrθK (τ ).             are provided in App. B.4.
                                                             (10b)
Each individual contactomorphism φrθk (τ ) updates the ini-               5. Contactomorphisms Generalization
tial point x by integrating, for a duration τ , the vector field
associated to the contact Hamiltonian Hrθk , defined as,                  Ensemble of contactomorphisms. Relying on a single
                                                                          contactomorphism to map the latent dynamics to the ambi-
              1 ⊤                                                         ent space neglects predictive uncertainty. While predictions
    Hrθk =      p Mθk (p)p + Vθk (q) + Fθk (q)s,         (11)
              2                                                           may closely align with the training trajectories on the data
where Mθk (p), Vθk (q), Fθk (q) are scalar functions of the               manifold, extrapolation in data-sparse regions tends to be
conjugate variables, parametrized by random Fourier fea-                  unreliable. To quantify uncertainty and identify the bound-
tures networks (Rahimi & Recht, 2007). The structure of                   aries of the data manifold, we propose to use an ensemble
Hrθk and the choice of network architecture are elaborated                of N contactomorphisms {φrn (T )}n∈[1,N ] , each randomly
in the ablation studies of App. C.3. The integration of the               initialized and trained on the same dataset (Syrota et al.,
associated vector field is performed using a contact split-               2024). In data-rich regions, the predictions from the ensem-
ting integrator (Zadra, 2023), as detailed in App. B.2. Our               ble closely match, while in regions with limited data, the
architecture is analytically invertible, minimizing the com-              predictions diverge, resulting in high model uncertainty.
putational cost of computing φ−1 rθ (τ ).                                 The ensemble-based uncertainty quantification, whether in
                                    k

Training a contactomorphism φr (T ), given a dataset of                   ambient or latent space, is computed by transforming the
B trajectories from the target dynamics {x̄b (t), t ∈                     starting point of the trajectories using the ensemble of con-
[0, tb ]}b∈[1,B] , involves the following steps: (1) We map               tactomorphisms to obtain N points:
the training trajectories to their corresponding latent tra-                          {z}n∈[1,N ] = {φrn (T )}n∈[1,N ] (x),          (14a)
jectories {z̄b (t), t ∈ [0, tb ]}b∈[1,B] via the contactomor-
phism φr (T ); (2) Starting from the initial latent states                            {x}n∈[1,N ] = {φ−1
                                                                                                      r n (T )}n∈[1,N ] (z).         (14b)

                                                                      5
