T2S-MPC: Real-Time Online Adaptive Model Predictive Control for Continuously Changing Dynamics

Zeyu Shen, Shiji Peng, Enrique Mallada, Zhuoyuan Wang, Laixi ShiarXiv 2026

TL;DR

Robots operating in the real world rarely enjoy static, textbook physics—wind gusts shift, payloads slosh and drain, and ground friction changes mid-stride. T2S-MPC (Two-Timescale Model Predictive Control) solves this by teaching a neural network to adapt to changing dynamics in real time during deployment, without offline pretraining. By updating the network's output layer rapidly and its hidden layers slowly—while running training asynchronously in the background—it beats state-of-the-art adaptive controllers on both simulated robots and a real-world quadrotor, all without missing a single 20 ms control deadline.

What Problem Does This Paper Address?

Model Predictive Control (MPC) is a workhorse of modern robotics: at every split-second, it uses a physics model to simulate future trajectories and pick the optimal control action. The catch is that real-world dynamics are messy and nonstationary. A quadrotor flies into shifting turbulence; a quadruped walks from carpet onto ice while carrying a leaking tank. When reality diverges from the nominal physics model, MPC performance degrades fast.

Learning-based MPC tries to patch this gap by learning the "residual" (the difference between the nominal model and reality) from live data. But there is a fundamental tension between expressiveness and speed:

  • Fast online methods (like linear models with fixed random Fourier features) can update within a 50 Hz control loop, but their fixed representations struggle when dynamics evolve in complex ways.
  • Expressive models (like deep neural networks or Gaussian processes) can capture rich nonlinearities, but retraining and evaluating them inside an MPC solver is often too slow for tight real-time budgets.

Methods

T2S-MPC bridges this gap with three core ideas:

  1. Time-Conditioned Residual Modeling: Instead of just feeding state and control inputs into a neural network to predict model errors, T2S-MPC also feeds in a time embedding (inspired by Transformer positional encodings). This lets the network capture how dynamics are trending over time, so MPC can anticipate changes across its entire prediction horizon.
  2. Two-Timescale Online Learning: The network is split into two parts: the hidden layers ($\theta_s$) and the linear output layer ($\theta_f$). Every few control steps, $\theta_f$ updates rapidly using only the newest observations, reweighting existing features to track immediate changes. Much less frequently, $\theta_s$ updates slowly using a replay buffer of both recent and historical data, refining the underlying feature representation without destabilizing the controller.
  3. Real-Time Execution: Evaluating a full neural network inside an MPC optimization loop is slow. T2S-MPClinearizes the learned residual locally at each prediction stage (using L4CasADi and acados) and runs the two-timescale training asynchronously in a background thread, swapping updated weights into the controller between MPC solves.
Figure 1: Overview of T2S-MPC. The learning loop updates the neural model at two timescales using online data, while the control loop uses the learned dynamics for MPC. The right panel shows quadrotor flight under varying wind and quadruped locomotion under varying payload and friction.

Datasets

Because T2S-MPC learns fully online from streaming deployment data, it does not use any static offline training datasets. Instead, the authors evaluate it on three dynamic benchmarks:

  • Quadrotor Simulation (PyBullet): A Crazyflie tracking a horizontal circle under three time-varying wind scenarios: Mean Wind Speed Increase, Turbulence-Intensity Increase, and Combined.
  • Quadruped Simulation (MuJoCo): A Unitree Go2 walking straight while carrying a draining, sloshing liquid payload (4 kg down to 2 kg) and/or traversing spatially varying ground friction (Liquid Drain, Varying Friction, and Combined).
  • Real-World Hardware: A physical Crazyflie 2.1+ quadrotor flying a circular path downstream of two PWM-controlled fans whose speeds oscillate periodically (sinusoidal and cosine profiles) with a 20 s period.

Key Insights and Ideas

  • Separating "what" from "how" enables fast adaptation: Updating only the linear output layer on recent data lets the model react quickly to sudden disturbances, while slow hidden-layer updates prevent catastrophic forgetting and keep the feature basis stable.
  • Time embeddings matter for prediction: Conditioning the residual on time allows MPC to reason about future variations over its horizon, rather than assuming the current disturbance is frozen.
  • Real-time tricks are non-negotiable: In ablation tests without stage-wise linearization and asynchronous training, MPC missed its 20 ms control deadline in 84% of cycles under single-timescale updates and 16% under two-timescale updates. With them, deadline misses dropped to 0%.

Key Results

T2S-MPC was compared against Nominal MPC (no learning), SSI-MPC (online random Fourier features), and STGP-MPC (spatio-temporal Gaussian processes):

  • Quadrotor Simulation: T2S-MPC achieved the lowest position and attitude errors across all three wind scenarios (e.g., 2.70 cm position error in the Combined scenario vs. 3.20 cm for SSI-MPC and 7.80 cm for Nominal MPC), with 0 deadline misses.
  • Quadruped Simulation: T2S-MPC completed 10/10 trials in every scenario with 0 deadline misses, beating Nominal MPC and SSI-MPC in velocity and height tracking. (STGP-MPC achieved slightly lower error on the few trials it survived, but crashed or failed in 6/10 Liquid Drain trials and 10/10 Varying Friction trials due to computational delays.)
  • Real-World Crazyflie: T2S-MPC reduced mean position error by 30% compared to Nominal MPC (3.67 cm vs. 5.25 cm) and max error by 20% compared to SSI-MPC (6.10 cm vs. 7.59 cm), running in 5.07 ms per cycle.

Limitations and Future Work

The authors note that T2S-MPC currently lacks formal theoretical guarantees for closed-loop stability and robustness. Future work will focus on establishing those guarantees and extending the framework to safety-critical and partially observed environments.

Summary updated

BibTeX
@misc{shen2026t,
  author = {Zeyu Shen and Shiji Peng and Enrique Mallada and Zhuoyuan Wang and Laixi Shi},
  title = {{T2S-MPC: Real-Time Online Adaptive Model Predictive Control for Continuously Changing Dynamics}},
  year = {2026},
  eprint = {2612.03242},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.03242},
}
Figure