How to train your differentiable filter

Alina Kloss, Georg Martius, Jeannette Bohg

TL;DR

Differentiable filters (DFs) combine the structural strengths of classical Bayesian filtering with the representational power of deep learning. This paper provides a comprehensive evaluation and practical "how-to" for training these models, demonstrating that DFs consistently outperform unstructured LSTMs by leveraging recursive probabilistic priors.

What Problem Does This Paper Address?

In robotics, "state estimation"—knowing where a robot or object is and how fast it's moving—is fundamental. Traditionally, we use Bayesian filters (like Kalman or Particle filters) which require hand-tuned "process models" (how things move) and "observation models" (how sensors see the world). However, manually defining these for complex data like camera images is incredibly difficult.

Deep learning offers an alternative: just use a Recurrent Neural Network (RNN) like an LSTM to map images directly to states. While flexible, LSTMs lack the geometric and probabilistic structure inherent in physics, often requiring massive amounts of data and failing to provide reliable uncertainty estimates.

Differentiable filters bridge this gap by making the steps of a Bayesian filter (prediction and update) differentiable, allowing neural networks to be embedded inside the filter and trained end-to-end. The challenge is that there is currently little guidance on which filter to choose, how to handle non-differentiable steps (like resampling), or which loss functions work best.

Methods

The authors implement and compare four types of differentiable filters:

  • dEKF (Extended Kalman Filter): Uses Taylor expansion to linearize models.
  • dUKF (Unscented Kalman Filter): Uses "sigma points" to propagate uncertainty. (Introduced as a novel differentiable variant here).
  • dMCUKF (Monte Carlo UKF): A sampling-based version of the UKF. (Also novel).
  • dPF (Particle Filter): Uses a set of weighted particles to represent complex, multi-modal distributions.

Key Innovations: * Learned Noise Models: Instead of assuming constant noise, the authors train networks to predict heteroscedastic noise—uncertainty that changes based on the state (e.g., "I'm less sure of the position because the object is currently occluded"). * Hybrid Architectures: They use "sensor networks" to compress high-dimensional images into compact observations and "residual process models" to learn physics corrections.

Datasets

The filters were evaluated on three distinct tasks:

  1. Simulated Disc Tracking: A controlled environment where a red disc must be tracked through distractors and occlusions.
  2. KITTI Visual Odometry: A real-world benchmark for tracking a car's position and heading from a front-facing camera.
  3. Planar Pushing: Tracking the pose of an object being pushed by a robotic arm, involving discontinuous contact dynamics (using the MIT Push dataset).

Key Insights and Ideas

  • Structure is a Superpower: DFs use significantly fewer parameters than LSTMs but achieve better accuracy. The "algorithmic prior" of the filter acts as a powerful inductive bias that helps the model generalize.
  • NLL vs. MSE: If you want accurate uncertainty, you must train using Negative Log Likelihood (NLL). Training on Mean Squared Error (MSE) might give slightly better raw tracking numbers, but it results in "overconfident" models that provide useless uncertainty estimates.
  • The "Sweet Spot" for Sequences: Training on very short sequences (1-2 steps) is poor because the model never learns to recover from errors. However, returns diminish after about 10 steps.
  • dEKF is the "Baseline" Hero: Despite being the simplest, the dEKF was the most numerically stable and easiest to get started with. The more complex filters (UKF, PF) can be better for highly non-linear problems but are more sensitive to initialization.

Key Results

  • Vs. LSTMs: In the KITTI task, the best DF (dPF-M-lrn) achieved a translation error of 14.3m, compared to 25.7m for a standard LSTM.
  • Heteroscedasticity Wins: Learning state-dependent noise significantly improved tracking. For example, in disc tracking, the dEKF learned to automatically increase its predicted observation noise from 0.9 (visible) to 29.3 (fully occluded).
  • End-to-End Training: Training the entire filter at once outperformed training the sensor and process models separately, as the end-to-end approach allows the models to "compensate" for each other's weaknesses.

Limitations and Future Work

  • Numerical Stability: Differentiable filters can be "fussy." Operations like matrix inversions in Kalman filters can fail if the learned noise matrices aren't strictly positive definite, leading to exploding gradients.
  • Out-of-Distribution (OOD) Issues: The filters struggled on the KITTI "Trajectory 1" (highway driving) because it was significantly faster than the training data. DFs currently lack a robust way to signal "I've never seen this before."
  • Future Directions: The authors suggest exploring "Switching Kalman Filters" to better handle contact states (like the make-or-break contact in robotic pushing) and automatically tuning filter hyperparameters (like the spread of sigma points) during training.

Summary updated

BibTeX
@inproceedings{kloss2021how,
  author = {Alina Kloss and Georg Martius and Jeannette Bohg},
  title = {{How to train your differentiable filter}},
  booktitle = {Auton. Robots},
  year = {2021},
  url = {https://openreview.net/forum?id=NoflJqUbKS},
}

Loading related content...

Figure