---
title: 'Differentiable Kalman Filter: Methods & Trends'
url: https://www.emergentmind.com/topics/differentiable-kalman-filter-dkf
type: topic
---

# Differentiable Kalman Filter: Methods & Trends

The differentiable Kalman filter (DKF) is, in the modern machine-learning sense, a Kalman-filter-based estimator whose prediction, update, and uncertainty-propagation operations are embedded in a differentiable computational graph, so that gradients can be propagated through the filter to optimize noise models, measurement models, dynamics operators, or upstream neural-network parameters end to end. In practice, this notion covers a family of hybrid model-based and learned estimators rather than a single canonical algorithm. The term is historically overloaded: “DKF” has also denoted desensitized, discriminative, deep, distributed, and even discrete Kalman filters in different literatures, so precise usage depends on context [2303.16846].

## 1. Terminological scope and acronym ambiguity

The acronym “DKF” does not identify a unique method across the filtering literature. A technically accurate reading therefore begins by disambiguating the major usages.

| DKF usage | Core meaning | Representative source |
|---|---|---|
| Differentiable Kalman Filter | Kalman recursion treated as a differentiable layer/module for end-to-end optimization | [2203.07207], [2309.14655], [2508.07037], [2509.07474] |
| Discriminative Kalman Filter | Closed-form filtering based on a learned Gaussian approximation to $p(\text{state}\mid \text{observation})$ | [1608.06622], [1807.06173] |
| Desensitized Kalman Filter | Filter that penalizes sensitivity to uncertain parameters | [1503.08379] |
| Deep Kalman Filter | Neural architecture outputting Gaussian probability measures from sequential data | [2310.19603] |
| Distributed/Discrete Kalman Filter | Networked or implementation-oriented variants unrelated to end-to-end differentiability | [1702.08262], [1703.05438], [1903.07807], [2208.09328], [2306.11476], [2501.13003], [2504.08302] |
| Kalman filters on differentiable manifolds | “Differentiable” refers to manifold geometry rather than autodiff-style training | [2102.03804] |

In the modern learning literature, a differentiable Kalman filter typically preserves the algebraic structure of Bayesian filtering while allowing gradient-based optimization through the filter. This distinguishes it from distributed DKF papers, where the “D” denotes distributed, and from manifold papers, where “differentiable” denotes smooth state spaces rather than trainable computation graphs [2501.13003], [2102.03804].

## 2. Differentiating the Kalman recursion

The most direct formulation of a differentiable Kalman filter treats the standard linear-Gaussian recursion as the forward pass and derives an exact backward pass for a scalar loss over the full trajectory. In the notation of the closed-form backpropagation work, the forward recursion is
\[
\hat x_{n|n-1} = A_n \hat x_{n-1|n-1} + B_n u_n,
\]
\[
P_{n|n-1} = A_n P_{n-1|n-1} A_n^T + Q_n,
\]
\[
z_n = y_n - H_n \hat x_{n|n-1},
\]
\[
S_n = H_n P_{n|n-1} H_n^T + R_n,
\]
\[
K_n = P_{n|n-1} H_n^T S_n^{-1},
\]
\[
\hat x_{n|n} = \hat x_{n|n-1} + K_n z_n,
\]
\[
P_{n|n} = (I - K_n H_n) P_{n|n-1}.
\]
A differentiable formulation then specifies a scalar objective
\[
L = \sum_{n=1}^{N} \bigl(l_{n|n-1} + l_{n|n}\bigr),
\]
and propagates matrix adjoints backward through the recursion to obtain exact gradients with respect to $P_0$, $Q_n$, $R_n$, and even the measurements $y_n$ [2303.16846].

For the negative log-likelihood
\[
NLL = \sum_{n=1}^{N} \log\det S_n + z_n^T S_n^{-1} z_n,
\]
the local derivatives include
\[
l_{S_n} = S_n^{-1} - S_n^{-1} z_n z_n^T S_n^{-1},
\]
\[
l_{P_{n|n-1}} = H_n^T \left( S_n^{-1} - S_n^{-1} z_n z_n^T S_n^{-1} \right) H_n,
\]
\[
l_{R_n} = S_n^{-1} - S_n^{-1} z_n z_n^T S_n^{-1},
\]
\[
l_{y_n} = -2 S_n^{-1} z_n.
\]
Because covariance parameters are symmetric, the gradients are symmetrized, and when a covariance is parameterized as $R = LL^T$, the gradient with respect to the factor is
\[
L_L = 2\,L_R\,L.
\]
This backward matrix-gradient formulation is computationally important: the paper reports $O(Nd^3)$ complexity for a full matrix derivative, versus $O(Nd^5)$ for classical forward sensitivity equations, with empirical speedups of about $53\times$ over sensitivity equations and about $38\times$ over PyTorch automatic differentiation in a synthetic $6$D example [2303.16846].

This suggests that the core mathematical content of a modern DKF is not a new filtering equation but a trainable forward–backward pair: a Kalman recursion in the forward pass and an exact or efficient adjoint in the backward pass.

## 3. Learned models inside the filter

A recurrent design pattern in differentiable Kalman filtering is to retain a structured process model while learning the components that are difficult to specify analytically. In visual-inertial odometry, the self-supervised DKF uses a robocentric EKF with an IMU-driven process model and a neural relative-pose measurement model. The network predicts both a relative pose and a measurement covariance
\[
\mathbf{R}_k = \begin{bmatrix} \boldsymbol{\Sigma}_{\phi_k} & \mathbf{0} \\ \mathbf{0} & \boldsymbol{\Sigma}_{r_k} \end{bmatrix},
\]
with diagonal entries parameterized by
\[
\sigma_i^2 = \sigma_0^2\,10^{\beta \tanh(w_i)}.
\]
The posterior state from the filter, rather than the raw network output, is then used in a self-supervised photometric reconstruction loss. On a visually degraded version of EuRoC, this estimator operated without a significant reduction in accuracy in cases where classical estimators consistently diverged, and it recovered metric scene scale from IMU information [2203.07207].

In cooperative 3D multi-object tracking, a differentiable multi-sensor Kalman filter is used to learn per-detection observation uncertainty for each connected autonomous vehicle. The tracking state is $10$-dimensional,
\[
{\bf s}_t = (x_t, y_t, z_t, a_t, l_t, w_t, h_t, dx_t, dy_t, dz_t)^T,
\]
the observation is $7$-dimensional,
\[
{\bf o}_t = (x_t, y_t, z_t, a_t, l_t, w_t, h_t)^T,
\]
and the covariance network predicts residual standard deviations whose squares define the diagonal of the measurement covariance. On V2V4Real, the resulting method improved tracking accuracy by $17\%$ with only $0.037\times$ communication costs compared with the state-of-the-art method [2309.14655].

A more adaptive line of work addresses online noise-statistics drift. OTAKNet constructs a source distribution from the filter’s predictive measurement model,
\[
p(y_t\mid y_{1:t-1}) = \mathcal{N}\bigl(y_t;\,\mathbf{h}(\hat x_{t\mid t-1}),\,\mathbf{S}_{t\mid t-1}\bigr),
\]
constructs a target distribution from the current observation and a window of past innovations, and minimizes an entropically regularized optimal-transport loss between them. The online update is
\[
\theta \leftarrow \theta - \eta_t\,\nabla_{\theta}\,\mathcal{L}_{ot},
\]
with no ground-truth state labels. On the NCLT dataset under limited training, OTAKNet achieved $7.10 \pm 3.03$ dB MSE versus $9.40 \pm 1.88$ for KalmanNet [2508.07037].

A more ambitious formulation makes the dynamics operator itself trainable. DKFNet treats filtering as an adjoint-based two-level optimization problem: first, a field inversion step optimizes a sequence of transition operators $\hat{\mathbf{F}_1},\ldots,\hat{\mathbf{F}_{n_t}}$ to reduce the residual
\[
\mathbf{e} =
\begin{bmatrix}
(\hat{\mathbf{H}_1 \hat{\mathbf{x}}_1 - \hat{\mathbf{z}}_1)^\intercal & \ldots &
(\hat{\mathbf{H}_{n_t} \hat{\mathbf{x}}_{n_t} - \hat{\mathbf{z}}_{n_t})^\intercal
\end{bmatrix}^\intercal,
\]
and then a neural closure model is trained via
\[
\hat{\mathbf{F}}_{\boldsymbol{\theta}} = DNN(\mathbf{x}, \mathbf{d}; \boldsymbol{\theta}).
\]
In the reported rocket and Allen–Cahn examples, the method reduced state reconstruction error by at least $90\%$ compared to the classical Kalman filter while maintaining uncertainty quantification [2509.07474].

## 4. Related DKF formulations outside the modern differentiable-programming sense

The discriminative Kalman filter is a separate, well-defined use of the acronym. It retains linear-Gaussian latent dynamics but replaces the generative observation model with a direct Gaussian approximation to the state posterior,
\[
p(z_t \mid x_t) = \eta_d(z_t; f(x_t), Q(x_t)).
\]
With predictive covariance
\[
M_{t-1} = A\Sigma_{t-1}A^+ + \Gamma,
\]
the closed-form recursion becomes
\[
\Sigma_t = \left(Q(x_t)^{-1} + M_{t-1}^{-1} - S^{-1}\right)^{-1},
\]
\[
\mu_t = \Sigma_t \left(Q(x_t)^{-1}f(x_t) + M_{t-1}^{-1}A\mu_{t-1}\right).
\]
This formulation performed substantially better than KF, EKF, and UKF on two synthetic nonlinear/non-Gaussian benchmarks and on rhesus macaque neural decoding, where normalized MSE averages were reported as $0.430$ for DKF-GP, $0.423$ for DKF-GP-freq, and $0.463$ for DKF-NN, versus $0.591$ for the Kalman filter [1608.06622]. A later human-neural-decoding study used the same acronym for a discriminative approach to Bayesian filtering and reported successful real-time use within the BrainGate2 clinical trial, including cursor control for three volunteers with quadriplegia and tablet typing by participant “T9” [1807.06173].

The desensitized Kalman filter is another distinct use. For a linear discrete-time system with uncertain constant parameter vector $p$,
\[
x_k = D_{k/k-1} x_{k-1} + Y_{k/k-1} p + G_{k-1} w_{k-1}, \qquad
z_k = H_k x_k + N_k p + v_k,
\]
the paper defines sensitivity matrices
\[
S_k^- = \frac{\partial e_k^-}{\partial p}, \qquad S_k^+ = \frac{\partial e_k^+}{\partial p},
\]
and minimizes
\[
J = \operatorname{Tr}(P_k^+) + \operatorname{Tr}(S_k^+ W S_k^{+T}).
\]
The resulting analytical gain is
\[
K_k = \left(P_k^- H_k^T + S_k^- W N_k^T\right)\left(H_k P_k^- H_k^T + N_k W N_k^T + R_k\right)^{-1}.
\]
A central result is that when the sensitivity-weighting matrix is chosen as the parameter covariance,
\[
W = P_{pp},
\]
the special desensitized Kalman filter is mathematically equivalent to the consider Kalman filter, with the bridge
\[
C_k^\pm = S_k^\pm P_{pp}.
\]
This paper resolves the DKF weighting choice by setting it equal to the a priori uncertain-parameter covariance [1503.08379].

The phrase “deep Kalman filter” is also not identical to “differentiable Kalman filter.” In the theoretical work on continuous-time DKFs, the model is a neural architecture
\[
\hat{F} = \operatorname{g\text{-}attn}_{N'}^{\vartheta} \circ \hat{f} \circ \operatorname{attn}_T^{\theta}
\]
that outputs Gaussian measures and is proved to uniformly approximate the conditional law of a broad class of non-Markovian, conditionally Gaussian signal processes on regular compact path sets. The approximation guarantee is stated in Wasserstein distance:
\[
\max_{0\le t\le T,\; y_{\cdot}\in K} \mathcal{W}_p\!\Big(\mathbb{P}(X_t\in\cdot \mid y_{[0:T]}), \hat F(t,y_{\cdot})\Big) < \varepsilon, \qquad 1\le p\le 2.
\]
This provides a theoretical tie between deep Gaussian-output sequence models and classical stochastic filtering, but it addresses a broader functional-approximation question than the usual end-to-end backpropagation-through-Kalman-recursion setting [2310.19603].

## 5. Geometry, manifolds, and what “differentiable” can also mean

In another neighboring literature, “differentiable” refers not to trainability but to state spaces that are differentiable manifolds. The on-manifold Kalman-filter framework defines
\[
\boxplus : \mathcal{M} \times \mathbb{R}^n \to \mathcal{M}, \qquad
\boxminus : \mathcal{M} \times \mathcal{M} \to \mathbb{R}^n,
\]
together with an $\oplus$ operation for system evolution, and writes the canonical on-manifold system as
\[
\mathbf{x}_{k+1}=\mathbf{x}_k\oplus_{\mathcal{M}_s}\left(\Delta t\mathbf{f}\left(\mathbf{x}_k, \mathbf{u}_k, \mathbf{w}_{k}\right)\right), \qquad
\mathbf{z}_k = \mathbf{h}\left(\mathbf{x}_k, \mathbf v_k \right).
\]
This yields a generic symbolic framework for prediction, update, and full iterated Kalman filtering on manifolds composed of $\mathbb{R}^n$, $SO(3)$, and $\mathbb{S}^2$, implemented in the IKFoM toolkit [2102.03804].

This manifold perspective is orthogonal to the modern DKF notion. It uses Jacobians and smooth structure, but it is not an autodiff-based learning framework. The distinction matters because many robotic filtering systems combine both ideas in practice: state representations may be on manifolds, while learned measurement or uncertainty models are trained through differentiable updates. The robocentric visual-inertial DKF is an example of such a hybridization, since it uses an EKF state involving orientations, gravity, velocity, and biases while still backpropagating self-supervised losses through the filtering pipeline [2203.07207].

## 6. Limitations, misconceptions, and current directions

A common misconception is that “DKF” always means differentiable Kalman filter. The literature does not support that reading: discriminative, desensitized, deep, distributed, discrete, and differentiable-manifold usages are all active, and several recent distributed-optimization papers explicitly distinguish their terminology from the machine-learning sense [2501.13003], [2504.08302].

Another misconception is that differentiability implies that the entire filter must be learned. The cited implementations suggest the opposite. In visual-inertial odometry, the IMU-driven process model is retained and only the visual measurement model and its covariance are learned; in cooperative tracking, the constant-velocity model and process covariance are fixed while measurement uncertainty is learned; in online adaptive filtering, the predictive measurement distribution is adapted through an OT loss rather than replacing the filter with a black-box recurrent model [2203.07207], [2309.14655], [2508.07037]. This suggests that the dominant role of DKF methods is to expose selected components of the filtering pipeline to gradient-based optimization, not to discard model structure.

The current literature also indicates several persistent technical constraints. Closed-form backpropagation results are derived for the classical linear-Gaussian Kalman filter and a scalar loss, even though they are highly useful as differentiable primitives [2303.16846]. Practical applications often restrict covariances to diagonal or block-diagonal forms for stability and tractability, as in learned per-detection observation covariances for cooperative tracking and diagonal visual measurement covariances for self-supervised VIO [2309.14655], [2203.07207]. When the latent system is high-dimensional, full covariance propagation becomes expensive; DKFNet explicitly points to block-diagonal, localized, low-rank, PCA, or SVD approximations as scalability strategies [2509.07474]. At the theoretical end, universal approximation results for deep Kalman filters hold uniformly only on sufficiently regular compact subsets of path space, not on all of infinite-dimensional path space [2310.19603].

Taken together, these results position the differentiable Kalman filter not as a single algorithmic object but as a research program: preserve the recursive probabilistic structure of Kalman filtering, expose the relevant algebra to differentiation, and learn the parts of the model that are uncertain, misspecified, or nonstationary.

Source: https://www.emergentmind.com/topics/differentiable-kalman-filter-dkf