Diff-Kalman: Difference-Driven Learning for Structure-Preserving Kalman Filtering

Jia Gao, Xianglei Xing, yang qing, Tianshuo Zhang, Wenzhe ZhaiNeurIPS 2026

TL;DR

Since the Apollo program, the Kalman filter has been our mathematical compass for tracking moving things through noisy data—provided the underlying physics are neat and well-behaved. When real-world chaos and nonlinearities strike, modern deep-learning fixes usually throw out the filter’s elegant structure to brute-force high-dimensional matrices. Diff-Kalman takes a smarter, surgical route: it preserves the classic "predict-update" loop while using neural networks to learn lightweight, difference-driven nudges that keep tracking sharp even in chaotic systems.

What Problem Does This Paper Address?

At its heart, state estimation is the art of guessing where something actually is (like a drone or a pedestrian) by blending a mathematical model of how it moves (prediction) with noisy sensor readings (update). Classical Kalman filters (KF) and their nonlinear cousins like the Extended Kalman Filter (EKF) excel at this, if your physics equations and noise estimates are spot-on. When reality diverges from your equations—a headache known as model mismatch—errors quickly snowball.

Recent hybrid methods (like KalmanNet) plug neural networks into the loop to learn adaptable behavior from data. However, they suffer from two blind spots:

  1. Heavy optimization: They try to directly regress massive, high-dimensional matrices (like the Kalman gain or full covariance matrices), which is tough to train and risks breaking mathematical rules, like keeping uncertainty matrices positive-semidefinite (PSD).
  2. Neglecting the prediction step: Most neural fixes only patch up the update phase, leaving the prediction phase completely reliant on brittle linearizations or Taylor expansions.

Diff-Kalman asks: Can we use neural networks to gently correct both prediction and update phases without breaking the Kalman filter's mathematical backbone?

Methods

Instead of replacing core filter matrices wholesale, Diff-Kalman preserves the standard KF/EKF recursion and injects learned, structured adjustments at three strategic points using Transformers and GRUs (Gated Recurrent Units).

Figure 1: The overall architecture of Diff-Kalman, which consists of two main phases: the Prediction Phase and the Update Phase.
  • Phase I: Prediction. Alongside the standard physics model predicting how much the state will change, a Transformer looks at a window of historical states (via self-attention) and the most recent state difference (via cross-attention) to forecast a data-driven "state increment." A GRU-based Scaling Predictor (GSP-$\alpha$) then dynamically blends the physics-based increment with the Transformer's increment. Next, because altering the state prediction changes our uncertainty, a second module (GSP-P) looks at the disagreement between the physics and the neural network to output a diagonal scaling matrix ($S_p$). This scales the prior covariance while mathematically guaranteeing it stays positive-semidefinite.
  • Phase II: Update. When a new sensor observation arrives, a third module (GSP-K) takes $S_p$ and the measurement residual (the surprise between expected and actual sensor data) to output another diagonal scaling matrix ($S_k$). This scales the Kalman gain dimension-by-dimension before the final state update.

To train this end-to-end, the authors supervise both prior and posterior state predictions, plus an auxiliary covariance loss using single-sample error outer products as pseudo-labels to keep uncertainty representations grounded.

Datasets

No new benchmarks were introduced; instead, the authors evaluated Diff-Kalman across two distinct regimes:

  • MOT Trajectory Dataset: Real-world pedestrian bounding-box trajectories {x, y, w, h} extracted from the MOT17 video benchmark, testing linear system tracking.
  • Lorenz Attractor Dataset: Simulated trajectories from the famous three-dimensional chaotic "butterfly" system, serving as a stress test for highly nonlinear dynamics.

Key Insights and Ideas

  • Fixing the state without fixing uncertainty breaks everything: In ablation studies on the chaotic Lorenz system, adding the Transformer's state-increment fixes without adjusting the prior covariance caused training to completely fail to converge. Adding GSP-P restored stability—proving that if you nudge a Kalman filter's state estimate, you must tell its uncertainty matrix what you did.
  • More history isn't always better in chaos: On smooth pedestrian paths, attention performance saturated after looking back just $L=3$ steps. On the chaotic Lorenz attractor, $L=32$ (roughly one oscillation cycle) was the sweet spot; looking further back fed the Transformer outdated, misleading dynamics that degraded accuracy.
  • Dimension-wise adaptability: Inspecting the learned weights on pedestrian tracking revealed intuitive specialization—the network dynamically varied fusion weights for tricky x, y positions (0.3–0.7) while maintaining a steady preference (~0.77) for neural increments when estimating bounding-box w, h sizes.

Key Results

Diff-Kalman consistently improved prior estimates and delivered top-tier posterior accuracy (measured in Mean Squared Error in dB, where lower is better):

  • MOT17 ($T=100$): Achieved the best prior (15.98 dB) and posterior (14.70 dB) MSE, beating classical KF (19.07 / 16.35 dB) and neural baselines like KalmanNet (20.74 / 14.84 dB), whose priors lagged due to lacking explicit prediction corrections.
  • Lorenz Attractor: Captured the lowest prior MSE across all noise levels and the best posterior MSE in three of four settings (e.g., -32.21 dB at SNR = 30 dB vs. EKF's -30.45 dB and SKNet's -31.75 dB).
  • Stress Testing: Under a brutal "Full Stress" scenario combining rotated physics/observation matrices, severe noise mismatch, and 20% sensor dropout, Diff-Kalman achieved 8.01 dB posterior MSE—dramatically outlasting KalmanNet (23.88 dB) and CKNet (20.29 dB).
Qualitative tracking on the chaotic Lorenz attractor under high observation noise, where Diff-Kalman visibly hugs the ground-truth butterfly wings tighter than classical and neural baselines.

Limitations and Future Work

Because Diff-Kalman explicitly uses the user-supplied process ($Q$) and measurement ($R$) noise matrices at every step of its covariance and gain math, it is noticeably more sensitive to pure $Q/R$ noise misconfigurations than methods like KalmanNet (which only use them for initialization). Under isolated severe $Q/R$ mismatch on Lorenz, KalmanNet edged out Diff-Kalman (-10.41 dB vs. -9.00 dB). Furthermore, the optimal history window length $L$ is system-dependent and requires tuning. Explicit directions for future work are not discussed in the paper.

Summary updated

Abstract

State estimation is a critical challenge in modeling dynamic systems. Classical Kalman filters can struggle with nonlinear dynamics, model mismatch, and inaccurate noise statistics. Although learning-aided methods improve adaptability, many focus on the update step or learn high-dimensional filtering quantities, complicating optimization and leaving prediction modeling underexplored. To address this, we propose Diff-Kalman, which leverages state differences to predict state increments and scaling matrices for correcting both the prediction and update phases of the Kalman filter. Diff-Kalman combines traditional dynamic models with neural networks to adaptively correct system behavior. In the prediction phase, Diff-Kalman utilizes a Transformer-based architecture with self-attention to extract localized patterns from historical states, followed by cross-attention to predict future state increments. These increments are then fused with increments predicted by the dynamic model, while a GRU-based Scaling Predictor (GSP) dynamically adjusts the prior covariance. In the update phase, another GSP dynamically adjusts the Kalman gain, improving estimation accuracy and robustness. Experimental results on linear MOT trajectories and nonlinear Lorenz dynamics show that Diff-Kalman improves estimation accuracy compared with representative baselines. The code is publicly available at https://github.com/heu-gj/Diff-Kalman.
BibTeX
@inproceedings{gao2026diff,
  author = {Jia Gao and Xianglei Xing and yang qing and Tianshuo Zhang and Wenzhe Zhai},
  title = {{Diff-Kalman: Difference-Driven Learning for Structure-Preserving Kalman Filtering}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=kk5tmlhwi6},
}
Figure