Preprint

SACK: Safe Active
Continual Koopman Learning

for Uncertain Systems with Contractive Guarantees

Chandan Kumar Sah*    Rajpal Singh*    Jishnu Keshavan
Department of Mechanical Engineering, Indian Institute of Science, Bengaluru
* Equal contribution
3R manipulator · corridor tracking, link masses −60% SACK
Franka Research 3 · resistive joint torque, footprint corridor SACK
Two quadrotors · cooperative navigation, +20% mass, 3 m/s wind SACK

SACK adapts an offline Koopman model online, in closed form, actively collects informative data while doing the task, and keeps the robot inside the safe set while its model is still changing.

~10×
faster model settling than neural adaptive Koopman on the 3R arm (0.12 s vs 1.17 s)
10−2 m
tracking RMSE maintained across a −90% to +90% link-mass sweep
0
collisions for the quadrotor under mass + wind shift; every baseline collides
0 / 20
TurtleBot3 hardware trials with any entry into the unsafe set

Abstract

Koopman operator theory represents nonlinear dynamics through a linear operator acting on lifted observables, enabling linear control techniques for nonlinear systems. However, Koopman models are typically learned offline and often degrade under model uncertainty and distributional shift between training and deployment. Existing adaptive Koopman methods either incur significant computational overhead or lack formal safety guarantees, limiting their use in real-time, safety-critical robotics. We propose SACK, a unified framework for safe continual Koopman learning that enables efficient online adaptation during task execution. A nominal Koopman model is first learned offline and then refined through a contractive adaptation law with theoretical convergence guarantees. To improve data efficiency, the framework integrates an active learning strategy that acquires informative data while accomplishing task objectives. We derive explicit bounds on model uncertainty and incorporate them within a robust MPC to establish formal safety guarantees, and introduce a conformal prediction-based tightening mechanism that calibrates safety margins online from observed residuals to reduce conservatism. Extensive simulations and hardware experiments across diverse robotic platforms demonstrate superior performance over state-of-the-art methods in safety-critical environments.

Motivation

A learned model is only as good as its training data

Payload changes, wind, actuator wear and the sim-to-real gap all move the deployed dynamics away from those seen in training. Adapting online is the natural fix, but it creates two problems that pull against each other.

Learning needs excitation

Tracking controllers produce smooth, correlated trajectories. The regressors become nearly collinear, the data Gramian becomes ill-conditioned, and online adaptation stalls exactly when it is needed. Deliberate excitation helps, but it costs task performance.

vs.

Safety needs an accurate model

Constraints enforced with an inaccurate, continually changing model are not guaranteed to hold. The risk peaks right after a shift, when new information is most valuable but the model used to plan exploratory actions is least reliable.

Central research question

“How can a robot adapt its learned dynamics under distributional shift without sacrificing safety during closed-loop operation?”

Contributions

What SACK brings together

The adaptation law, the exploration objective and the safety margins are derived from the same quantity: the regressor Gramian that governs how fast the model error contracts.

01

Contractive continual Koopman adaptation

A closed-form, windowed recursive update for the Koopman matrices with exponential contraction of the estimation error under persistent excitation, and an explicit ultimate bound when the true dynamics drift.

02

Active data acquisition coupled to adaptation

A D-optimal log-det objective on the predicted regressor Gramian inside receding-horizon control, with a certified lower bound on its minimum eigenvalue that links exploration directly to contraction.

03

Safety-aware continual learning

Model-error bounds propagated into tightened CBF constraints for recursive feasibility and forward invariance, plus conformal residual calibration for less conservative margins with probabilistic coverage.

04

Validation across diverse robots

A 3R manipulator, single and cooperative planar quadrotors, a 7-DoF Franka Research 3 in Gazebo, and a TurtleBot3 in hardware with deliberately induced wheel mismatch.

Method

The SACK architecture

Offline, an autoencoder learns the lifting map $\psi(\cdot)$ and nominal matrices $(A,B,C)$. Online, $\psi$ and $C$ stay fixed while $(A,B)$ are adapted at every step, feeding an active-learning MPC whose safety constraints are tightened by the current model uncertainty.

SACK architecture: offline training block, adaptive module, safety tightening and active-learning MPC

Figure 1. Offline (top), the lifting map and nominal Koopman matrices are identified from nominal input–output data. Online (bottom), the adaptive module updates $\hat W_k = [\hat A_k, \hat B_k]$ from windowed prediction errors; the safety-tightening module computes the one-step margin $\delta_{x,k}$ (analytical or conformal); and the active-learning MPC jointly performs tracking, information-seeking excitation and safety-constrained control.

0

Koopman lifted model and its error

A dictionary of observables $z_k = \psi(x_k)$, which contains the state itself, lifts the dynamics into a space where they are approximately linear. Predictions over a horizon are then affine in the inputs, so MPC reduces to a QP:

$$\hat z_{k+1|k} = A z_k + B u_k, \qquad \hat x_{k+1|k} = C\,\hat z_{k+1|k}, \qquad C = [\,I_{n_x}\;\; 0\,].$$

The realized error splits into a truncation term fixed by the dictionary and a parameter-mismatch term that is linear in the regressor $v_k = [z_k^\top, u_k^\top]^\top$. Distributional shift inflates the mismatch term, and because it enters linearly it can be removed online by refining $(A,B)$ alone.

1

Contractive online adaptation

Using the $w$ most recent regressor–observation pairs $(V_k, Z_k^+)$ with exponential forgetting $\Gamma = \mathrm{diag}(\gamma^{w-1},\dots,\gamma,1)$, the Koopman matrices are updated in closed form—no gradient steps, no network retraining:

$$\hat W_{k+1} = \hat W_k + \eta\, E_k^{\text{pred}}\,\Gamma V_k^\top, \qquad E_k^{\text{pred}} := Z_k^+ - \hat W_k V_k .$$

The estimation error $E_k = W_k^* - \hat W_k$ then evolves through the weighted regressor Gramian $G_k = V_k \Gamma V_k^\top$:

$$E_{k+1} = E_k\,(I - \eta G_k) + \tilde\Delta_k, \qquad \|\tilde\Delta_k\|_F \le \nu_{\text{eff}} .$$
Theorem 1 · exponential contraction If $\lambda_{\min}(G_k) \ge \underline\lambda > 0$ and $0 < \eta < 2/\bar\lambda$, then $\|E_k\|_F \le \rho^k \|E_0\|_F + \frac{1-\rho^k}{1-\rho}\,\nu_{\text{eff}}$ with $\rho < 1$, so $\limsup_{k\to\infty}\|E_k\|_F \le \nu_{\text{eff}}/(1-\rho)$. The rate is set by the conditioning of $G_k$, and Lemma 2 relaxes the requirement to excitation over a block of $T$ steps, so windows shorter than the regressor dimension are admissible.

The forgetting factor caps the drift-induced bias: for $\gamma < 1$ the inflation term in $\nu_{\text{eff}}$ is bounded independently of the window length, which justifies moderate windows with exponential forgetting.

2

D-optimal active-learning MPC

Since conditioning of the Gramian is the lever on the convergence rate, the MPC directly rewards it. The predicted matrix $S_k(U)$ stacks the stored regressors (with their forgetting weights) and the planned ones (with unit weight), and the controller trades tracking against information through the exploration weight $\beta$:

$$\min_{U}\; \sum_{i=k}^{k+N_p-1} \Big(\|C\hat z_{i|k} - x_{\text{ref},i}\|_Q^2 + \|u_{i|k}\|_R^2\Big) \;-\; \beta \log\det\!\big(S_k(U) + \varepsilon I\big)$$ $$\text{s.t.}\quad \hat z_{i+1|k} = \hat A_k \hat z_{i|k} + \hat B_k u_{i|k},\quad u_{i|k}\in\mathcal U^t_{i-k},\; \hat z_{i|k}\in\mathcal Z^t_{i-k},\; \hat z_{k+N_p|k}\in\mathcal Z_f,$$ $$h\big(C\hat z_{i+1|k}\big) \ge (1-\alpha_{\text{cbf}})\,h\big(C\hat z_{i|k}\big) + L_h\,\sigma_{i-k}.$$

The log-det penalizes small eigenvalues most heavily, so it pushes excitation into the directions that are weak in the data already stored, rather than over-exciting directions that are already informative. The nonconvex problem is solved in real time by SQP, with each subproblem a standard QP.

Theorem 2 · excitation certificate If some feasible input sequence $U^{\text{good}}$ achieves $\lambda_{\min}(S_k) \ge \lambda_0$ and $\beta$ is large enough, every feasible $U$ with $J(U) \le J(U^{\text{good}})$—in particular the optimizer—satisfies $\lambda_{\min}(S_k(U)) \ge \lambda^* > 0$. The optimizer cannot sacrifice all excitation to improve tracking.
3

Safety under a changing model

The one-step prediction error $d_k = E_k v_k$ enters the true transition as a bounded disturbance. SACK supplies the CBF margin $\delta_{x,k}$ in one of two complementary ways:

Deterministic

Analytical bound

Propagates the adaptation bound into a worst-case margin and horizon-wise constraint tightening:

$$\delta^{\text{ana}}_{x,k} = \|C\|_2\, v_{\max}\, \bar E_k .$$

Theorem 3: recursive feasibility of the MPC, forward invariance $x_k \in \mathcal S$ for all $k$, and ultimately bounded prediction error. Can become conservative when excitation is weak.

Probabilistic

Conformal calibration

Scores the residual not anticipated by an EMA of past discrepancies and takes a finite-sample quantile:

$$\delta^{\text{conf}}_k = \hat Q_{1-\chi}\big(\{r_j\}_{j\in\mathcal W_k}\big) + \|\hat s_{k-1}\|_2 .$$

Theorem 4: per-step coverage $\mathbb P\big(h(x_{k+1}) \ge (1-\alpha_{\text{cbf}})h(x_k)\big) \ge 1-\chi$, and safety over any horizon $H < 1/\chi$ with probability $\ge 1 - H\chi$.

The two are complementary operating regimes rather than interchangeable guarantees: the analytical margin gives deterministic robustness under explicit boundedness and excitation assumptions; the conformal margin trades worst-case robustness for lower conservatism and relies on local exchangeability of recent residuals.

Algorithm 1 · SACK at a glance
  1. offline — train the autoencoder to obtain $\psi(\cdot), A, B, C$; set $\hat W_0 \leftarrow [A,B]$.
  2. for each step $k$: lift $z_k \leftarrow \psi(x_k)$.
  3. Build $V_{k-1}, Z^+_{k-1}, \Gamma$, compute $G_{k-1}$ and $E^{\text{pred}}_{k-1}$, and update $\hat W_k$ by the contractive law.
  4. Compute the margin $\delta_{x,k}$ — analytical, or conformal (raw quantile during warm-up, EMA-corrected afterwards).
  5. Solve the D-optimal active-learning MPC by SQP; apply $u_k^*$ and observe $x_{k+1}$.
  6. // conformal mode: push the new residual $r_k$ into the calibration window
Results

Evaluation across four robotic platforms

Every model is trained offline under nominal conditions and then deployed under post-training shift from parameter changes, external disturbances, or the sim-to-real gap. All controllers use full-state feedback and ACADOS.

SACK (ours) NK — nominal Koopman, no adaptation NAK — neural adaptive Koopman AcK — EDMD active learning GMPC — GP-based dual MPC
7.1

3R serial manipulator

3R serial manipulator schematic

Figure 2. Fully actuated 3R arm in a 3-D workspace; each joint rotates about its body $z$-axis.

The nominal model is trained for link mass $m_i = 0.6$ kg and length $l_i = 1$ m; distribution shift is induced by changing the link masses. The coupled rigid-body dynamics $M(\theta)\ddot\theta + C(\theta,\dot\theta)\dot\theta + G(\theta) = \tau$ make the input map configuration dependent, so the lifted model is only approximately linear—a good stress test for online adaptation.

The reference trajectories are collision-free by design, so any controller that adapts fast enough should stay inside the corridor even without an explicit safety mechanism.

Task 1 — Safe exploration in a constrained corridor link masses −60%

Only SACK and GMPC stay inside the corridor; NK, NAK and AcK leave it. The executed SACK trajectory deviates slightly from the reference to explore informative directions, which is what lets the contractive update suppress the model error so quickly.

SACK (ours) stays in corridor
NAK corridor violation
AcK diverges
NK diverges
3R corridor comparison: trajectories, collision events, prediction error, computation time

Figure 4. (a) End-effector trajectories in the corridor, red marking violations. (b) Collision events. (c) Dynamic prediction error $e_{\text{dyn}}$. (d) Computation time per iteration; SACK-N is SACK without active learning ($\beta = 0$).

0.12 s vs 1.17 sSettling time of $e_{\text{dyn}}$ for SACK vs NAK—roughly ten times faster, and without NAK's secondary error spike.
~104× cheaperper iteration than GMPC, which stays safe but whose nonlinear MPC and online GP updates preclude real time.
Negligible overheadfrom the adaptation law itself: SACK-N runs at the cost of NK; most of SACK's cost is the information objective.
3R corridor with obstacles: trajectory, obstacle distances, prediction error, conformal margin

Figure 3. Corridor with obstacles under a 40% link-mass reduction. (a) SACK traverses the corridor without collision. (b) Distance to each obstacle stays above the safety boundary. (c) $e_{\text{dyn}}$ settles in about 0.1 s. (d) The conformal margin $\delta_{x,k}$ shrinks as the model error falls.

Task 2 — Tracking under parametric mismatch link masses −90% → +90%

With obstacles and corridors removed, SACK tracks hypotrochoid, petal and helix references with RMS errors of 0.0151, 0.0159 and 0.0324 m at −60% mass, and stays at the $10^{-2}$ m level over the full sweep, while NK exceeds 3 m under moderate-to-large shifts.

3R tracking of hypotrochoid, petal and helix references

Figure 5. Tracking under a 60% link-mass reduction: (a) hypotrochoid, (b) petal, (c) helix.

RMSE versus mass change, with and without active learning

Figure 6. Tracking RMSE over a −90% to +90% mass sweep. (a) SACK vs baselines. (b) Ablation: SACK without the information objective.

Active learning matters Keeping the same adaptation law but setting $\beta = 0$ produces much larger errors under moderate-to-large shifts. Passive closed-loop data do not condition the regression problem well enough; actively shaping the data is what keeps adaptation reliable.
7.2

Planar quadrotor

An underactuated, agile platform with two thrust inputs. The model is trained with no wind ($m = 2$ kg, $I = 1$ kg·m², $l_{\text{arm}} = 0.2$ m). At deployment, a non-parametric wind disturbance $F_w$ is added to a mass change, so the true Koopman operator drifts over time ($\nu > 0$)—unlike the fixed parametric shifts of the manipulator.

SACK updates the operator directly from lifted prediction errors, so it does not need to identify the individual sources of mismatch separately.

Planar quadrotor schematic with wind gust

Figure 7. Planar quadrotor with thrusts $T_1, T_2$ under wind.

Task 1 — Cooperative navigation under model mismatch +20% mass, 3 m/s wind

SACK · two agents, independent models and MPCs collision-free

Each quadrotor adapts its own Koopman model and solves its own MPC, with safety constraints covering both static obstacles and the other agent. Both traverse the obstacle field without collision, the inter-agent distance stays above the threshold, and $e_{\text{dyn}}$ settles in about 0.05 s; a small $\beta = 10$ is enough because the quadrotor dynamics already excite the regressors richly.

Two-quadrotor trajectories, inter-agent distance and prediction error

Figure 8. (a) Closed-loop trajectories; arrows show wind direction and dashed circles the obstacle safety boundaries. (b) Inter-agent distance. (c) Dynamic prediction error.

Task 2 — Safe tracking under severe mass and wind disturbance +30% mass, 5 m/s wind

SACK is the only method that satisfies the obstacle constraints throughout. NAK reduces the mismatch but too slowly, so its early predictions are wrong for long enough to cause violations; GMPC struggles because the wind is not part of its GP input, so similar state–input pairs map to different residuals.

SACK (ours) 0 collisions
NAK 75 events
AcK 236 events
NK 63 events
Planar quadrotor obstacle-constrained comparison

Figure 9. (a) Closed-loop trajectories, red marking safety-boundary violations. (b) Collision events—NK 63, NAK 75, GMPC 167, AcK 236, SACK 0. (c) Dynamic prediction error.

7.3

Franka Research 3 (Gazebo)

Franka Research 3 corridor setup in Gazebo

Figure 10. The full projected end-effector footprint (blue) must stay inside the safe region (green).

A 7-DoF arm tracks a reference through a narrow 3-D corridor under a set-valued geometric constraint: motion is unsafe whenever any part of the end-effector footprint crosses the boundary, even if the reference point is inside. A resistive joint torque $\tau_d = -0.4\,\tau$ creates the post-training mismatch.

Under both nominal and disturbed dynamics, SACK keeps the footprint inside the corridor while the conformal tightening adjusts to the residual uncertainty. NAK violates the boundary once the torque disturbance is applied; NK fails in both conditions.

Corridor-constrained tracking in Gazebo

SACK (ours) footprint inside
NAK footprint inside
NK corridor violation

Top: Gazebo rendering of the FR3. Bottom: end-effector path (blue) against the reference (dashed), with the projected footprint shaded and the admissible corridor outlined in orange; red segments mark violations. Use the toggle to switch between nominal and disturbed dynamics.

FR3 corridor tracking: SACK, NAK and NK under nominal and disturbed conditions

Figure 11. (a–c) Nominal; (d–f) resistive torque $\tau_d = -0.4\,\tau$. (a,d) SACK, (b,e) NAK, (c,f) NK. Red crosses mark corridor violations.

7.4

Hardware experiments: TurtleBot3

The Koopman model is trained entirely in Gazebo and deployed on a TurtleBot3 Burger. Here the mismatch is not prescribed: SACK must handle the sim-to-real gap plus unmodeled hardware effects. Three configurations of increasing mismatch are tested on an open-circuit (OC) and a closed-circuit (CC) obstacle course.

TurtleBot3 Burger and wheel rings

Figure 12. (a) Nominal robot. (b) Axisymmetric ring that enlarges the left wheel's effective radius. (c) Eccentric ring that makes the radius vary periodically. (d) Ring mounted on the left wheel.

Table 1 · 20 hardware trials

TrackSACKNAKNK
Open circuit 0.2440 unsafe steps 1.59384 unsafe steps 1.2676 unsafe steps
Closed circuit 0.1120 unsafe steps 0.984389 unsafe steps 1.329669 unsafe steps

Average tracking RMSE (m) and average number of time steps in the unsafe set. The longer CC track lets SACK collect more informative data, which shows up as lower RMSE.

SACK on hardware

Open circuit

Nominal robot · no ring 0 unsafe steps
Axisymmetric ring · left wheel 0 unsafe steps
Eccentric ring · left wheel 0 unsafe steps

Closed circuit

Nominal robot · no ring 0 unsafe steps
Axisymmetric ring · left wheel 0 unsafe steps
Eccentric ring · left wheel 0 unsafe steps

SACK runs on the TurtleBot3 with the model trained only in Gazebo, under increasing mismatch: nominal wheels, an axisymmetric ring that enlarges the left wheel's effective radius, and an eccentric ring that makes it vary periodically. Open-circuit runs are shown first, followed by the closed-circuit runs.

Distribution of SACK trajectories across 20 hardware trials

Figure 13. Mean SACK trajectory and ±1 SD band across all 20 trials and configurations: (a) open circuit, (b) closed circuit. The band tightens late in the CC track as adaptation accumulates data.

Representative TurtleBot3 trials under increasing mismatch

Figure 14. Representative trials on the open circuit (a–c) and closed circuit (d–f): nominal robot (a,d), axisymmetric ring (b,e), eccentric ring (c,f). Red crosses are safety-margin violations.

Even the nominal robot breaks the baselines NK and NAK violate the safety margins from the sim-to-real gap alone, and degrade further with the wheel rings.
SACK: zero unsafe steps in every trial, including the eccentric ring where the mismatch varies continuously during motion—repeatable safety rather than isolated successful runs.
Discussion

Takeaways and limitations

Information sets the adaptation rate. Contraction is governed by the regressor Gramian, so exploration follows from the analysis rather than being an add-on heuristic.
An update law alone is not enough. With exploration removed, the same law fails under large shifts: adaptation depends both on how parameters are updated and on the data they are updated from.
Transient speed decides safety. Eventual model accuracy does not suffice—slow adaptation can mispredict long enough to violate constraints before converging.
Refine locally instead of generalizing globally. The offline model provides a nominal lifted representation; continual refinement covers payloads, disturbances and hardware not seen in training.

Limitations & future work

  • The lifting map $\psi$ is fixed after training; shifts that change the needed observable subspace cannot be compensated by adapting $(A,B)$ alone.
  • Worst-case analytical margins can be conservative and may make the MPC infeasible in tight spaces.
  • The exploration weight $\beta$ is set or scheduled by hand; online tuning from Gramian conditioning is open.
  • The information-seeking MPC is nonconvex; scaling to higher-dimensional and larger multi-agent systems needs more scalable objectives and solvers.

Citation

@article{SACK2026,
  title   = {SACK: Safe Active Continual Koopman Learning for Uncertain Systems with Contractive Guarantees},
  author  = {Sah, Chandan Kumar and Singh, Rajpal and Keshavan, Jishnu},
  journal = {Preprint},
  year    = {2026}
}