---
title: Recursive KalmanNet
url: https://www.emergentmind.com/topics/recursive-kalmannet
type: topic
---

# Recursive KalmanNet

Recursive KalmanNet (RKN) is a deep learning-augmented state estimation framework that combines the classical predictor-corrector structure of the Kalman filter (KF) with recurrent neural networks (RNNs) to deliver accurate state estimates and provably consistent error covariances in linear dynamical systems with unknown and potentially non-Gaussian noise statistics. By propagating uncertainty using a recursive generalization of Joseph’s formula and optimizing the Gaussian negative log-likelihood, RKN addresses fundamental deficiencies of both classical KFs (which require precise knowledge of noise covariances and Gaussianity) and fully data-driven approaches that lack principled uncertainty quantification [2506.11639].

## 1. State-Space Problem Formulation

RKN operates within the standard linear state-space model:
- **State transition:** $x_k = F_k x_{k-1} + v_k$
- **Observation:** $z_k = H_k x_k + w_k$

where $x_k \in \mathbb{R}^m$ is the hidden state, $z_k \in \mathbb{R}^n$ is the measurement, and $F_k \in \mathbb{R}^{m\times m}$ and $H_k \in \mathbb{R}^{n\times m}$ are known system matrices. The process noise $v_k$ and measurement noise $w_k$ are zero-mean, mutually independent (but otherwise arbitrary) white processes, typically with unknown, possibly heavy-tailed or multi-modal covariances $Q_k$ and $R_k$. This departs from the canonical Kalman filter’s assumption of known, independent Gaussian noise and places RKN in the broader category of data-driven filtering techniques designed for realistic, adverse scenarios [2506.11639].

## 2. Recursive KalmanNet Architecture

The RKN framework retains the Kalman filter’s "predict–correct" recursion but replaces analytic gain computation and covariance update with two dedicated recurrent networks:

- **Gain Network (RNN #1, parameters $\Theta_1$):**
  - Input features $\phi_k$ at each time $k$ include innovation $\hat{y}_k = z_k - H_k \hat{x}_{k|k-1}$, the last gain update $K_{k-1} \hat{y}_{k-1}$, the system Jacobian $H_k$, and the measurement increment $z_k - z_{k-1}$.
  - The hidden state $h^\text{gain}_k$ is evolved by a GRU and fully connected layers and outputs the estimated Kalman gain $\hat{K}_k$.

- **Covariance Network (RNN #2, parameters $\Theta_2$):**
  - Receives the same feature vector $\phi_k$.
  - Outputs the Cholesky factor $C_k$ of a learned noise-dependent covariance term $B_k = C_k C_k^\top$ for correction.

The forward pass at each step $k$ comprises prediction, feature formation, gain computation, partial covariance update (using Joseph’s formula), learned covariance correction, composition of full error covariance, and state update [2506.11639]. Algorithmically:

| Step         | Formula / Description                                                                            | Network Used    |
|--------------|--------------------------------------------------------------------------------------------------|-----------------|
| Prediction   | $\hat{x}_{k|k-1} = F_k \hat{x}_{k-1|k-1}$                                                        | None            |
| Feature Form | $\phi_k = [\hat{y}_k; \hat{K}_{k-1}\hat{y}_{k-1}; H_k; z_k-z_{k-1}]$                            | None            |
| Gain Update  | $h^\text{gain}_k\leftarrow \mathrm{GRU}(h^\text{gain}_{k-1}, \phi_k),\ \hat{K}_k$                | RNN #1          |
| Covariance   | $A_k = (I - \hat{K}_k H_k) F_k \hat{P}_{k-1|k-1} F_k^\top (I - \hat{K}_k H_k)^\top$              | None            |
| Covar Update | $h^\text{cov}_k\leftarrow \mathrm{GRU}(h^\text{cov}_{k-1}, \phi_k),\ C_k \to \hat{B}_k = C_kC_k^\top$ | RNN #2     |
| Full Covar   | $\hat{P}_{k|k} = A_k + \hat{B}_k$                                                                | Both            |
| Correction   | $\hat{x}_{k|k} = \hat{x}_{k|k-1} + \hat{K}_k \hat{y}_k$                                          | Both            |

This approach ensures that RKN’s corrected covariance estimates remain symmetric and positive semi-definite regardless of the gain network’s output, leveraging the mathematical properties of the Joseph update [2506.11639].

## 3. Joseph’s Formula and Uncertainty Quantification

A core principle of RKN is explicit uncertainty propagation using the Joseph-formula-based update:
$$
P_{k|k} = (I - K_k H_k) P_{k|k-1}(I - K_k H_k)^\top + K_k R_k K_k^\top
$$
where $K_k$ is produced by RNN #1, and $R_k$ is generally unknown. $P_{k|k-1}$ is predicted using system dynamics. When $Q_k$ and $R_k$ are not available, RKN learns only the $B_k$ (noise-dependent) correction via a Cholesky parameterization, and $A_k$ is exactly computed from known model structure and the approximated gain. This guarantees mathematically consistent error covariance estimates and distinguishes RKN from classical KalmanNet, which does not explicitly propagate error covariances [2506.11639, 2107.10043].

## 4. Training Objective and Optimization

RKN is trained end-to-end on fully observed sample trajectories $\{(x^{(i)}_t, z^{(i)}_t)\}$. The estimation error at each step is $e^{(i)}_t = x^{(i)}_t - \hat{x}^{(i)}_{t|t}$. The loss function is the regularized Gaussian negative log-likelihood:
$$
\mathcal{L}^{(i)}_t(\Theta_1, \Theta_2) = e_t^\top (\hat{P}_{t|t}^{(i)})^{-1} e_t + \log\det \hat{P}_{t|t}^{(i)} + \lambda\left(\|\Theta_1\|_2^2 + \|\Theta_2\|_2^2\right)
$$
Minibatch time-series training is performed with Adam optimizer, learning rate decay, and up to 200 epochs for convergence. Initial weights use Xavier/He initialization, and no prior knowledge of $Q_t$ or $R_t$ is assumed or provided at any stage [2506.11639].

## 5. Empirical Evaluation and Comparative Performance

Empirical studies in [2506.11639] utilize a synthetic 1D constant-speed dynamical model with heavy-tailed, bimodal-Gaussian (non-Gaussian) measurement noise. Several baselines are considered:

- **o-KF:** Oracle Kalman Filter (full access to $R_k$)
- **so-KF:** Sub-optimal KF with fixed $R = \sigma^2_w I$
- **CKN:** Cholesky KalmanNet

Evaluation uses mean squared error (MSE) and mean scaled Mahalanobis distance (MSMD), measuring both prediction accuracy and consistency of covariance quantification. Across diverse noise heterogeneity levels, RKN achieves near-oracle MSE and MSMD $\approx m=2$ (state dimension) for all noise regimes, outperforming both so-KF and CKN. The learned RKN gain tracks the oracle’s time-varying gain under Bernoulli mixture noise, and only RKN’s estimated covariance matches the empirical error spread [2506.11639].

## 6. Theoretical Properties, Advantages, and Limitations

RKN’s integration of Joseph’s formula ensures that:
- All output covariances are guaranteed symmetric and positive semi-definite—critical for consistent uncertainty quantification.
- The split into $A_k$ (computed via model) and $B_k$ (learned via Cholesky network) leverages model-based information without requiring noise statistics.
- RKN demonstrates robustness to non-Gaussian, heteroscedastic, and temporally varying noise, regimes in which both classical KFs and prior variants such as Cholesky KalmanNet (CKN) and KalmanNet [2107.10043] fail to achieve consistent error quantification.

However, the generalization properties of RKN under severe out-of-distribution noise are not fully characterized; further research is needed to impose additional constraints for global statistical consistency and to extend the approach to nonlinear state-space models (e.g., via Extended or Unscented Kalman Filter assimilation) [2506.11639].

## 7. Relationship to Related Approaches

RKN generalizes and improves upon KalmanNet [2107.10043], which replaces analytic gain computation with an RNN but does not update or propagate error covariances. While KalmanNet has demonstrated significant empirical robustness and plug-in applicability for partially known or nonlinear systems, its implicit treatment of uncertainty is limited. GSP-KalmanNet [2311.16602] further extends the neural-aided Kalman paradigm to graph-structured data, addressing high-dimensionality and graph topology by combining graph spectral filtering with RNN-learned gains. However, unlike RKN, these variants typically do not guarantee consistent covariance quantification, nor do they incorporate a Cholesky-based covariance network regulated by Joseph’s formula.

In summary, Recursive KalmanNet combines principled state-space recursion, mathematically consistent uncertainty propagation, and data-driven adaptation, outperforming both analytical and prior neural-augmented Kalman filtering methods in the presence of unknown and non-Gaussian noise [2506.11639].

Source: https://www.emergentmind.com/topics/recursive-kalmannet