Nonlinear Control · Incremental Stability · Learning
When a flow forgets where it started.
Contraction theory turns nonlinear stability into a single matrix inequality — and that inequality is exactly what lets you bolt a neural network onto a controller without losing guarantees. Pair it with meta-learning and you get something that classical adaptive control, robust control, and end-to-end deep learning each can't deliver alone. Scroll through the math, then watch three controllers fight a crosswind.
01
The picture: trajectories converging to each other
Classic stability asks “does the system reach one special point?” Contraction asks the stronger question: do all trajectories converge to each other? Below, dozens of trajectories start from random states (colored by origin) and all get funneled onto the same moving reference orbit. The gap between any two collapses exponentially — that collapse is contraction. Move the λ slider and re-scatter to test it.
State space · x₁ vs x₂
t = 0.0 s
Contraction rate λ
0.50 1/s
e-fold time 1/λ
2.0 s
Spread vs start
100%
Trajectories
60
Spread ‖δx(t)‖
measured vs e−λt
Contraction rate λ0.50
Swirl ωₛ1.20
reference xd(t)measured spreade−λt bound
02
The math: one inequality certifies everything
Take a nonlinear system. Instead of tracking one trajectory, track the infinitesimal gap \(\delta x\) between two neighboring ones.
$$\dot{x} = f(x,t) \qquad\Longrightarrow\qquad \dot{\delta x} = \frac{\partial f}{\partial x}(x,t)\,\delta x = J(x,t)\,\delta x$$
Differentiating the dynamics gives the differential dynamics: how a tiny perturbation evolves, governed by the Jacobian \(J\).
Measure the gap’s length with a state-dependent metric \(M(x,t)\succ0\) and watch it shrink:
$$V=\delta x^{\top} M(x,t)\,\delta x, \qquad \dot V = \delta x^{\top}\!\big(\dot M + MJ + J^{\top}M\big)\delta x$$
\(V\) is a differential Lyapunov function — a “warped” squared distance between trajectories.
$$\boxed{\;\dot M + MJ + J^{\top}M \;\preceq\; -2\lambda M\;} \qquad\Longleftrightarrow\qquad \tfrac12\big(F+F^{\top}\big)\preceq -\lambda I$$
The contraction condition (\(F=(\dot\Theta+\Theta J)\Theta^{-1}\) with \(M=\Theta^{\top}\Theta\)). With \(\lambda\) fixed this is a linear matrix inequality — the same convex tooling as linear control, now for nonlinear systems. Finding \((M,\lambda)\) is necessary and sufficient for incremental exponential stability.
$$\|\delta x(t)\| \;\le\; \sqrt{\tfrac{\overline m}{\underline m}}\;\|\delta x(0)\|\,e^{-\lambda t}, \qquad \underline m\,I \preceq M \preceq \overline m\,I$$
Every gap decays exponentially at rate \(\lambda\). This is the curve the demo above plots against the measured spread.
The payoff for safety — a tube you can size. If a bounded disturbance \(d\) (wind, payload, model error) hits the system, exponential stability converts it into a bounded deviation:
$$\|x(t)-x^{\star}(t)\| \;\le\; \underbrace{\frac{\bar d}{\lambda}\sqrt{\tfrac{\overline m}{\underline m}}}_{\textstyle \text{steady-state tube}} \;+\; \underbrace{\sqrt{\tfrac{\overline m}{\underline m}}\,\|x(0)-x^{\star}(0)\|\,e^{-\lambda t}}_{\textstyle \text{vanishing transient}}$$
The actual trajectory is trapped in an explicit tube of radius \(\sim \bar d/\lambda\) around the nominal one. Bigger contraction rate ⇒ tighter tube.
03
The geometry underneath: geodesics & the true distance
The metric \(M(x)\) isn’t just bookkeeping — it bends state space into a curved (Riemannian) space. The “distance” between two states is no longer the straight Euclidean line; it’s the length of the shortest path measured in the metric — the geodesic. Where \(M\) is large, every step costs more, so the shortest path bows toward cheaper regions.
$$L(c)=\int_0^1\!\sqrt{c'(s)^{\top} M(c(s))\,c'(s)}\;ds,\qquad E(c)=\int_0^1\! c'(s)^{\top} M(c(s))\,c'(s)\;ds$$
Walk any path \(c\) from \(x_1\) to \(x_2\) and add up the local metric-rulers \(\sqrt{\delta x^{\top}M\,\delta x}\): that’s its Riemannian length \(L\). The energy \(E\) is the squared version — smoother to optimize.
$$d(x_1,x_2)=\inf_{c}\,L(c)\qquad\text{with}\qquad L(c)^2\le E(c)\ \ \text{(Cauchy–Schwarz, equality at constant speed)}$$
The geodesic distance is the length of the shortest path \(\gamma\). Minimizing the quadratic energy \(E\) recovers the same minimizer and fixes its speed — exactly what the demo below does numerically.
$$\frac{d}{dt}\,d\big(x_1(t),x_2(t)\big)\ \le\ -\lambda\,d\big(x_1(t),x_2(t)\big)\quad\Longrightarrow\quad d(t)\le d(0)\,e^{-\lambda t}$$
§02’s infinitesimal gaps \(\delta x\) are the tangent vectors; stitched along the geodesic they give the honest distance between two trajectories — and that is what contracts. The geodesic length is the incremental Lyapunov function.
Why control engineers care. In a Control Contraction Metric the squared geodesic distance to the reference is a control Lyapunov function, and the feedback is built by integrating a local law along the geodesic:
$$\mathcal{E}(x,x^{\star})=d(x,x^{\star})^2\ \text{is a CLF},\qquad u=u^{\star}+\int_0^1 k\big(\gamma(s),\gamma'(s)\big)\,ds$$
A CCM induces an infinite family of local Lyapunov functions, so the controller tracks any feasible time-varying reference with no redesign — you just recompute the geodesic to the new target.
Warped space · geodesic vs straight line
peak M = 6.0
Euclidean
—
Straight · in metric
—
Geodesic · true dist
—
Metric ridge height · peak of M6.0
Drag endpoints A and B. The dashed line is the metric-blind straight shot through the costly ridge; the cyan geodesic relaxes to the true shortest path and bows around it. Its length is shorter in the metric than the straight line — even though it’s longer in plain Euclidean terms.
geodesicstraight linecostly region · large M
The practical cost. Computing that minimizing geodesic in real time is the bottleneck of CCM control — it’s an infinite-dimensional search over all smooth curves, so it’s discretized and solved by pseudospectral (Chebyshev) collocation in a few milliseconds, by a geometric heat-flow PDE, or as a small nonlinear program. The neural route (aNCM) sidesteps the solve entirely by learning the metric so no geodesic is needed online — and the whole picture generalizes beyond the 2-norm to Finsler geometry when a Riemannian metric is too restrictive.
04
Finding M: a convex search (LMI & sum-of-squares)
§02 ended on a promise: the contraction condition is an LMI. But for a nonlinear system \(M(x)\) is a matrix-valued function of state, and the inequality must hold at every \(x\) — an infinite-dimensional feasibility problem. The remarkable part is that, posed differentially, it stays convex, unlike the search for an ordinary Lyapunov function.
$$\text{find}\ \ M(x)\succeq \varepsilon I,\ \ \lambda>0\qquad\text{s.t.}\qquad \dot M + J^{\top}M + MJ \;\preceq\; -2\lambda M\quad\forall x$$
A feasibility problem, convex in \(M\) for fixed \(\lambda\). The two catches: it must hold for all \(x\), and \(M\) is a whole matrix field — not a handful of numbers.
For a linear system this collapses to a single Lyapunov LMI \(A^{\top}M+MA\preceq-2\lambda M\). For nonlinear systems the set of ordinary control-Lyapunov functions can be non-convex or even disconnected — yet studying the system differentially recovers exactly the linear-style convexity.
$$v^{\top}\!\Big(-\big(\dot M + J^{\top}M+MJ+2\lambda M\big)\Big)v\ \ \text{is a sum of squares in }(x,v)\ \ \Longrightarrow\ \ \text{an SDP}$$
The engine. The brutal “\(\forall x\)” becomes tractable: requiring the matrix to admit an SOS certificate (\(p=\sum_i g_i^2\ge0\)) turns the search into a semidefinite program a solver cracks offline in seconds — for polynomial dynamics.
$$W=M^{-1}\succ0,\qquad B_{\perp}^{\top}\big(\dot W_f - JW - WJ^{\top} - 2\lambda W\big)B_{\perp}\;\succeq\;0$$
For control synthesis (CCM): written in the dual metric \(W=M^{-1}\), the condition becomes a convex pointwise LMI. \(B_{\perp}\) spans the directions the actuators can’t touch — contraction need only be certified there, since the input handles the rest. Solve once, offline.
The space of metrics · M = [[p, q],[q, 1]]
target λ = 0.25
Target λ
0.25
λ-max at this M
—
Certificate
—
Target contraction rate λ0.25
Brightness = how contractive each metric \(M\) certifies the system to be (its \(\lambda_{\max}\)); the bright band is the feasible set at your target \(\lambda\) — and it’s convex. Drag the dot to pick a metric (its unit-ball ellipse shows bottom-right). The dashed parabola is the edge of \(M\succ0\); outside it \(M\) isn’t a metric. Identity (tick at p=1, q=0) certifies \(\approx0.30\); the best metric reaches \(\approx0.40\). Push \(\lambda\) past that and the feasible set vanishes — no certificate exists.
feasible metricyour choiceM ≻ 0 boundary
The bridge to learning. Swap the polynomial-plus-SOS parameterization for a neural network \(M_\theta(x)\) and enforce the same inequality on a batch of sampled states during training — that is precisely the Neural Contraction Metric, the learned-metric backbone behind the meta-learning controller in §06.
05
The hook for learning: uncertainty that’s linear in features
Real drones have unknown forces — aerodynamics, ground effect, wind. The classic adaptive-control trick is to write the unknown part as known nonlinear features \(\Phi(x)\) times unknown linear weights \(a\):
$$\dot{x} = f(x) + g(x)\,u \;+\; \underbrace{\Phi(x)\,a}_{\textstyle \text{unknown disturbance}}$$
Because \(a\) enters linearly, it can be estimated online with an update law that runs as fast as the feedback loop — far cheaper than retraining a network.
The catch: nobody knows the right features \(\Phi\) for messy aerodynamic effects. Hand-designing them is exactly where classical adaptive control struggles. That gap is what meta-learning fills.
06
Meta-learning supplies the features
Collect data across many environments (dozens of wind conditions). Meta-learning finds a single shared basis \(\Phi_\theta(x)\) such that, in every environment, the leftover force is captured by some linear \(a\). Two ideas make it control-grade:
Offline · learned once
Data
Many environments
Past flights across varied winds / payloads — each a different hidden parameter w.
Meta-train
Control-oriented + adversarial
Learn the basis inside a closed-loop objective (not plain regression), and make it environment-invariant via a domain-adversarial loss (DAIML) so all wind-specific info is forced into the linear weights a.
Output
Shared basis Φ(x)
A fixed feature map + a warm prior on a — the controller’s “muscle memory.”
Online · per flight, real time
Adapt
Update weights a
Cheap linear estimator corrects for the wind it actually feels — converging in seconds because the hard representation work is already done.
Certify
Contraction metric M
Acts as the Lyapunov certificate that keeps the joint controller-estimator provably stable.
Result
Tight, guaranteed tracking
Exponentially-bounded error even under unseen winds and learning error.
$$\underbrace{\min_{\theta}\;\sum_{k\in\text{envs}} \mathcal{L}_{\text{control}}\!\Big(\Phi_\theta,\ \mathrm{adapt}(\Phi_\theta;\mathcal D_k)\Big)}_{\textstyle \text{control-oriented (closed-loop)}} \quad\text{vs.}\quad \underbrace{\min_{\theta}\;\sum_{k}\big\|\Phi_\theta(x)\hat a_k - d_k\big\|^2}_{\textstyle \text{plain regression}}$$
Key insight (Richards–Azizan–Slotine–Pavone): meta-learn features for closed-loop control, not just to fit data. The features are chosen on a “need-to-know” basis — only what helps the controller track.
07
The combination: composite adaptation under a contraction certificate
Glue the online estimator to a contracting controller and analyze them together. Define a joint energy in tracking error \(e=x-x_d\) and weight error \(\tilde a=\hat a-a\):
$$V \;=\; \underbrace{e^{\top} M(x)\,e}_{\textstyle \text{contraction term}} \;+\; \underbrace{\tilde a^{\top}\Gamma^{-1}\tilde a}_{\textstyle \text{learning term}}$$
One Lyapunov function for the controller and the learner — the contraction metric \(M\) supplies its first half.
$$\dot{\hat a} \;=\; -\,\Gamma\Big(\underbrace{\Phi(x)^{\top} M\,e}_{\textstyle \text{tracking error}} \;+\; \underbrace{\Phi(x)^{\top} R^{-1}\big(\Phi(x)\hat a - y\big)}_{\textstyle \text{prediction error}}\Big)$$
Composite adaptation: the weights are driven by both how badly we’re tracking and how badly we’re predicting the measured force \(y\). Using both signals makes adaptation faster and smoother.
$$\dot V \;\le\; -2\lambda\, e^{\top} M e \;+\; \varepsilon_{\text{learn}} \qquad\Longrightarrow\qquad \|e(t)\| \ \text{is exponentially bounded}$$
The controlled trajectory stays in a tube around the target despite parametric uncertainty, neural-network learning error \(\varepsilon_{\text{learn}}\), and external disturbance — guarantees a black-box deep policy can’t give you.
08
Watch it: three controllers fight the same crosswind
All three drones chase the same figure-8 reference through the same wind field. Robust uses no learning, online-adaptive learns simple features from a cold start, and meta-learned + contraction arrives with the right features and a warm prior. Crank the wind and watch who holds the line. (Conceptual simulation — illustrates the qualitative behavior, not a benchmark.)
Tracking · figure-8 + wind field
wind 0.45
Robust (no learning)
—
Fixed feedback. Wind shows up as a permanent lag ≈ |d|/λ. Safe but loose.
Online-adaptive (cold)
—
Learns a constant correction from scratch each flight — cancels average wind, but a poor feature set leaves the position-varying gust uncorrected.
Meta-learned + contraction
—
Right features + warm prior from offline meta-learning; contraction keeps the fast online update stable. Glued to the reference, even as wind changes.
Wind strength0.45
09
Why the combination beats today’s systems
Each existing approach gives up something. Meta-learning + contraction is the rare design that keeps all four columns green at once:
Approach
Feature / model
Online speed
Stability guarantee
Data need
Unseen conditions
Classical adaptive control
hand-picked features (often wrong)
fast (linear)
yes (Lyapunov)
low
poor — wrong basis
Robust / H∞ control
fixed worst-case model
none
yes (conservative)
—
sluggish, over-cautious
End-to-end deep RL
expressive, learned
slow / none online
none
very high
brittle off-distribution
Meta-learning + contraction
expressive, learned offline
fast (linear)
yes (contraction tube)
low — minutes of flight
adapts / extrapolates
The one-sentence version
Meta-learning gives you the expressiveness of deep learning, the linear structure gives you the speed of adaptive control, and contraction theory gives you a provable, exponentially-shrinking error tube — simultaneously. That trifecta is what put a $35-Raspberry-Pi drone through narrow gates in a 12 m/s wind tunnel with centimeter-level tracking.
10
Coda — the dual problem: observers & output-feedback
Everything so far drove a tracking error to zero. Flip the picture: an observer drives an estimation error to zero, reconstructing the full state from partial, noisy measurements. Because contraction is built from the differential dynamics, the two problems are duals — the nonlinear analogue of the classic Kalman-filter ↔ LQR symmetry.
$$\dot{\hat x} = f(\hat x) + L\big(y - h(\hat x)\big),\qquad e=x-\hat x,\quad \dot e \approx \big(A - LC\big)e$$
Copy the dynamics, then correct with gain \(L\) times the measurement mismatch (\(A=\partial f/\partial x,\ C=\partial h/\partial x\)). The estimation error \(e\) must contract — the mirror image of making a tracking error contract.
$$\dot M + A^{\top}M + MA - C^{\top}G^{\top} - GC \;\preceq\; -2\lambda M,\qquad L=M^{-1}G$$
The §04 control LMI with the arrows reversed. The substitution \(G=ML\) makes the observer-gain search a convex pointwise LMI again — solved offline, exactly as for the controller.
$$\|x(t)-\hat x(t)\| \;\le\; \sqrt{\tfrac{\overline m}{\underline m}}\,\|e(0)\|\,e^{-\lambda t}\;+\;\underbrace{\frac{\bar n}{\lambda}\sqrt{\tfrac{\overline m}{\underline m}}}_{\textstyle \text{noise tube}}$$
Measurement noise of size \(\bar n\) traps the estimate in a tube of radius \(\sim\bar n/\lambda\) around the truth — the exact dual of §02’s disturbance tube. (The stochastic version bounds the mean-squared error via the contraction rate and noise intensity.)
Observer · estimate locks onto truth
measuring x₁ only
Error rate λ
0.75
‖x − x̂‖
—
Noise n̄
0.08
Estimation error ‖e(t)‖
vs e−λt
Observer gain L1.0×
Measurement noise n̄0.08
The gold dot is the true state circling; the observer is fed only its x₁ coordinate (plus noise, the dashed line). The cyan estimate starts from a wrong guess and spirals in. Raise the gain to contract faster; raise the noise and the estimate settles into a tube rather than a point — the dual of the disturbance tube.
true stateestimate x̂
Why it matters. Solve the controller LMI and the observer LMI independently; a separation principle then combines them into an output-feedback controller that needs no direct state measurement — a drone flying aggressive trajectories from noisy onboard sensors alone. And since both reduce to finding one metric \(M\), a single Neural Contraction Metric learned offline can serve estimator and controller at once, with one function evaluation per step.
Key references
Lohmiller & Slotine (1998). On contraction analysis for non-linear systems. Automatica. — the original framework.
Manchester & Slotine (2017). Control Contraction Metrics: convex and intrinsic criteria for nonlinear feedback design. IEEE TAC.
Lopez & Slotine (2021). Adaptive nonlinear control with contraction metrics. IEEE L-CSS.
Tsukamoto, Chung & Slotine (2021). Neural Contraction Metrics / aNCM; Contraction theory for learning-based control: a tutorial overview.
Manchester & Slotine (2014). Output-feedback control of nonlinear systems using control contraction metrics and convex optimization — the controller/observer duality and separation principle.
Tsukamoto, Chung & Slotine (2020/2021). Neural Contraction Metrics for robust estimation and control: a convex optimization approach — one learned metric for both estimator and controller via duality.
Disclosure
This is just a learning place, and may have errors, no responsable if someone use it.