Residual Learning towards High-fidelity Vehicle Dynamics Modeling with Transformer

Jinyu Miao, Rujun Yan, Bowei Zhang, Tuopu Wen, Kun Jiang, Mengmeng Yang, Jin Huang, Zhihua Zhong, Diange Yang

TL;DR

This paper introduces DyTR (Dynamic residuals correction Transformer), a novel deep learning network that improves vehicle dynamics modeling by predicting and correcting the errors (residuals) of simple physics models rather than predicting vehicle states from scratch. When applied to complex distributed electric vehicles, DyTR slashes prediction errors by up to 92.3%, effectively bridging the gap between computational efficiency and high-fidelity simulation for autonomous driving.

What Problem Does This Paper Address?

Accurate vehicle dynamics modeling—predicting how a vehicle moves over time based on control inputs like steering and torque—is foundational for safe autonomous driving (AD) planning and control. Traditionally, engineers rely on physics-based models. Simple models (like a 3 Degree-of-Freedom bicycle model) are computationally fast but prone to drifting over long horizons because they simplify complex real-world forces. Conversely, highly detailed models (like 14 DoF models) require tedious, expensive parameter identification and still struggle with modern distributed electric vehicles (where each wheel can be controlled independently).

While pure deep learning approaches can fit these complex non-linearities, they act as "black boxes" that generalize poorly to unseen driving conditions or different vehicle weights. The authors address this accuracy-vs-generalization trade-off by shifting the paradigm from direct state estimation to Dynamics Residual Correction (DRC).

Fig. 1. The diagram of (a) the Dynamic State Estimation (DSE) methods and (b) the Dynamics Residual Correction (DRC) methods.

Methods

Instead of forcing a neural network to learn vehicle physics from scratch, the DRC framework uses a simple 3 DoF physics model as a baseline and tasks a neural network with predicting only the error (residual) of that baseline.

The authors' custom architecture, DyTR, breaks this down into three distinct modules:

  1. Feature Extraction: Historical vehicle states and control signals over a time window ($T$) are encoded into high-dimensional features using standard Multi-Layer Perceptrons (MLPs) or Kolmogorov-Arnold Networks (KANs).
  2. Temporal Fusion: A Transformer Encoder processes these features, applying attention mechanisms to capture how vehicle states evolve over time.
  3. Residual Estimation: This is the core novelty. The future state predicted by the simple physics model ($\hat{s}_{t+1}$) and the vehicle's configuration ($c$, specifically its mass) are combined into a dynamics residual query. A Transformer Decoder then iteratively updates this query by interacting with the aggregated historical features, ultimately decoding it into the exact state correction ($\delta_{t+1}$).
Fig. 3. The network structure of our proposed Transformer-based DRC model, DyTR. The model takes historical T-step states, T-step control signals, vehicle configurations, and estimated future states by the base model as input, and estimates the residuals of dynamics states.

Datasets

Because public datasets detailing the dynamics of distributed electric vehicles are scarce, the authors built a high-fidelity co-simulation pipeline using MATLAB/Simulink and CarSim. They simulated a full-size 4WD distributed SUV to serve as the ground truth.

The resulting dataset contains roughly 761,000 data points, split into three parts:

  • train: 28 driving conditions across 9 different vehicle masses.
  • val1: The same 28 driving conditions but evaluated on an unseen vehicle mass (testing configuration generalization).
  • val2: Completely unseen driving conditions and an unseen vehicle mass (testing full generalization).

Key Insights and Ideas

  • Residuals are easier to learn: Physics models already capture the macro-level behavior of a vehicle. The remaining errors (caused by friction, tire slip, etc.) are low-amplitude and structurally similar across different scenarios. This makes the residual function much easier for a neural network to map than the raw, high-variance vehicle states.
  • Queries as error correctors: Treating the baseline physics prediction as a high-dimensional "query" allows the Transformer decoder to selectively pull relevant historical context (like past steering or acceleration trends) to refine the error estimate iteratively.
  • Explicitly embedding vehicle mass: By feeding the vehicle mass directly into the residual query, the network avoids overfitting to a single vehicle type, allowing a single trained model to adapt to varying payloads.

Key Results

The authors compared DyTR against pure physics models (3 DoF and 14 DoF) and several deep learning baselines (MLPs, KANs, and Informer).

  • Massive Error Reduction: On the val1 dataset, DyTR reduced the state prediction errors of the simple 3 DoF model by an average of 92.3%. On the highly challenging val2 dataset (unseen conditions and mass), it still achieved a 59.9% error reduction.
  • Outperforming Complex Physics: A simple 3 DoF model corrected by DyTR significantly outperformed a standalone, highly complex 14 DoF physics model.
  • Superiority over Standard DNNs: DyTR consistently beat standard MLPs and specialized time-series models like Informer, proving that the query-based Transformer decoder architecture is uniquely suited for error-correction tasks.
Fig. 4. A case of the state correction performance by DyTR on the val1 split.

Limitations and Future Work

The primary limitation of this study is its total reliance on simulation data (CarSim). While CarSim is an industry standard for vehicle dynamics, real-world sensors introduce noise, latency, and environmental anomalies (like sudden ice patches) that simulation cannot fully capture. The authors note that transitioning this framework to real vehicle calibration and testing is the logical next step to validate its real-world viability.

Summary updated

Abstract

The vehicle dynamics model serves as a vital component of autonomous driving systems, as it describes the temporal changes in vehicle state. In a long period, researchers have made significant endeavors to accurately model vehicle dynamics. Traditional physics-based methods employ mathematical formulae to model vehicle dynamics, but they are unable to adequately describe complex vehicle systems due to the simplifications they entail. Recent advancements in deep learning-based methods have addressed this limitation by directly regressing vehicle dynamics. However, the performance and generalization capabilities still require further enhancement. In this letter, we address these problems by proposing a vehicle dynamics correction system that leverages deep neural networks to correct the state residuals of a physical model instead of directly estimating the states. This system greatly reduces the difficulty of network learning and thus improves the estimation accuracy of vehicle dynamics. Furthermore, we have developed a novel Transformer-based dynamics residual correction network, DyTR. This network implicitly represents state residuals as high-dimensional queries, and iteratively updates the estimated residuals by interacting with dynamics state features. The experiments in simulations demonstrate the proposed system works much better than physics model, and our proposed DyTR model achieves the best performances on dynamics state residual correction task, reducing the state prediction errors of a simple 3 DoF vehicle model by an average of 92.3% and 59.9% in two dataset, respectively.
BibTeX
@article{miao2025residual,
  author = {Jinyu Miao and Rujun Yan and Bowei Zhang and Tuopu Wen and Kun Jiang and Mengmeng Yang and Jin Huang and Zhihua Zhong and Diange Yang},
  title = {{Residual Learning towards High-fidelity Vehicle Dynamics Modeling with Transformer}},
  journal = {IEEE Robotics Autom. Lett.},
  year = {2025},
}
Figure