Noise Regimes as Tasks: Likelihood-Weighted Training for Learned Kalman Filters

A learned Kalman filter is a classical tracker whose correction step is partly computed by a small neural network. Such filters are trained by minimizing squared tracking error summed over time. When the sensor noise switches between quiet stretches and loud bursts, this ordinary loss behaves like a badly balanced multi-task objective. Each noise regime acts as a separate "task", and the burst segments produce errors, and therefore gradients, orders of magnitude larger than the quiet ones. The filter spends its capacity on the bursts and becomes mediocre everywhere else. We propose to fix this imbalance with a per-time-step weighting that comes from the filter itself. The filter predicts its own noise level and error covariance at every step in a single deterministic pass. Training then uses a Gaussian likelihood in which each step's error is divided by that predicted covariance.

The two-sentence version is this. Training a learned filter with plain squared error on non-stationary data is unitary scalarization across noise regimes, and loud regimes win. Making the filter output its own time-varying covariance and training on the resulting likelihood rebalances the regimes automatically, estimates the noise level online without an oracle, and yields calibrated uncertainty without the sampling cost of ensembles.

Core Claim

Our central object is a per-step loss that generalizes homoscedastic uncertainty weighting to heteroscedastic, time-varying weights tied to the filter's own covariance recursion. Homoscedastic weighting learns one fixed uncertainty per task; heteroscedastic means the weight changes from step to step. At each step $t$, the network reads a short window of past innovations and outputs a diagonal observation-noise covariance $\hat R_t$ and a process-noise covariance $\hat Q_t$. The innovation is the gap between the measurement and its prediction. The filter then computes the gain, the posterior state covariance $\Sigma_t$ and the predicted innovation covariance $S_t$ analytically. Training minimizes

$$\mathcal{L} = \sum_t \Big[ (x_t-\hat x_t)^\top \Sigma_t^{-1}(x_t-\hat x_t) + \log\det\Sigma_t \Big] \;+\; \lambda \sum_t \Big[ e_t^\top S_t^{-1} e_t + \log\det S_t \Big],$$

where $x_t$ is the true state, $\hat x_t$ the filtered estimate, $e_t = y_t - \hat y_t$ the innovation, and $\lambda$ a single scalar.

The first term is the state loss reweighted per step by the filter's confidence. Multi-Task Learning Using Uncertainty to Weigh Losses for Scene Geometry and Semantics is the special case in which $\Sigma$ is a constant per task. The second term is an auxiliary task that needs no ground-truth state at all, because it asks only that innovations look like draws from $\mathcal{N}(0, S_t)$. That term trains the noise estimator on observations alone.

The claim is falsifiable. Compared with the same architecture trained on squared error, the likelihood-trained filter should show a much smaller error gap between quiet and burst regimes, should cost little or nothing on burst-regime error, and should report consistent covariances. Consistent means the normalized estimation error squared (NEES, the squared error divided by the reported covariance) averages near the state dimension.

Where This Sits

Hybrid filtering supplies the backbone and motivates the problem. KalmanNet replaces the analytic gain with a recurrent network. It beats the extended and unscented Kalman filters by 5–10 dB on a mismatched Lorenz system and reaches 22.2 dB on NCLT against 25.3 dB for a classical Kalman filter. Because it learns the gain directly, it discards the covariance, and it was trained on stationary noise. Adaptive KalmanNet handles shifting noise by modulating KalmanNet with a small hypernetwork, conditioned on a "State of the World" ratio of process to observation noise. It needs that ratio from an external oracle, and its authors name automatic estimation of it as future work. Our $\hat R_t$, $\hat Q_t$ head is exactly that missing estimator, and the self-supervised innovation term is how it is learned without labels. Bayesian KalmanNet recovers covariance by Monte Carlo dropout, at 104.88 ms per step against 5.279 ms for an extended Kalman filter. We get covariance from one deterministic pass through the analytic recursion.

AirIO is the closest structural relative. It predicts body-frame velocity plus an uncertainty that feeds an extended Kalman filter. It treats that uncertainty as a measurement covariance for one learned observation, not as a loss weight balancing noise regimes during training, and it does not study switching interference.

Multi-task optimization constrains the design. In Defense of the Unitary Scalarization shows that plain loss sums with standard regularization match specialized optimizers on vision and reinforcement-learning benchmarks. It argues that many of those optimizers merely under-optimize. This is a negative result we must respect, so we compare against a well-regularized unweighted sum rather than a strawman. Gradient Surgery (PCGrad) shows the opposite pull: large gains when gradient magnitudes are badly imbalanced, which is precisely our quiet-versus-burst situation. Our setting is a natural place to test which view holds, because the imbalance here has a known physical cause.

On the noise side, SN-Net motivates treating interference as an explicit modeled quantity rather than a residual. Its bidirectional design cannot run inside a causal filter, so we take the lesson (model the noise) and not the architecture.

Research Program

We will build a single causal filter with three parts: a known or partially known motion model, a light gated recurrent noise estimator over the recent innovations, and the analytic gain and covariance recursion. The same network will be trained under four objectives while architecture, data and tuning budget are held fixed.

The first is plain squared error. The second is unitary squared error plus an auxiliary innovation-likelihood term. The third is squared error with oracle inverse-variance weighting using the true simulated noise level. The fourth is the full likelihood above.

The analysis centers on regime-stratified error. We label each time step by its true noise regime in simulation. We then report error in dB separately for quiet and burst steps, and measure per-regime gradient norms during training to confirm that the imbalance hypothesis is the actual mechanism.

We also study a known failure mode. Likelihood training with learned variance can inflate predicted covariance on hard steps and stop fitting them. We will monitor burst-regime error for this under-fitting. If it appears, we will test a stop-gradient variant, in which the weight is detached from the mean error, as a fix.

Finally, we test partial supervision. On a fraction of trajectories we will train with the innovation term only. This asks how much of the ground-truth dependence of KalmanNet can be removed.

Baselines

The naive reference is a classical extended Kalman filter with fixed noise covariances tuned on the training set. It fixes the floor any learned method must clear.

The strongest classical competitor is an innovation-based adaptive Kalman filter. This filter re-estimates $R_t$ from the sample covariance of innovations over a sliding window. It solves the same online noise-identification problem with no learning, so it directly threatens our claim. We will tune its window length on the same validation split, and our method beats it only if burst-onset error and NEES after regime switches are better at matched latency.

The strongest learned competitor is KalmanNet, trained on the same mixed-noise data with its published squared-error objective. On stationary NCLT it reports 22.2 dB MSE. We will retrain it on burst-injected NCLT, since no result for switching noise is reported on Lacuna. We will also run Adaptive KalmanNet given the true noise ratio as an oracle upper bound, and given our estimated ratio as a two-stage pipeline.

For uncertainty, Bayesian KalmanNet is the comparison. Its reported 104.88 ms per step sets the latency we aim to undercut by an order of magnitude at comparable NEES.

The key ablation is our own architecture trained with plain squared error. It isolates the loss from the covariance-predicting structure. A second ablation adds PCGrad, with each noise regime treated as a task. It asks whether generic gradient surgery captures the same benefit at higher cost.

All methods get the same trajectories, the same hyperparameter search budget of equal trials, and early stopping on the same validation error. Beating a baseline means lower quiet-regime error with burst-regime error no worse than roughly 0.5 dB, together with NEES closer to the state dimension.

Why not just…?

Why not just train KalmanNet on mixed-noise data and let its recurrent state infer the noise level? This is the most serious threat, because KalmanNet's inputs include innovations, which carry noise information. Our hypothesis concerns the objective, not the inputs: under squared error, the network has the information but no incentive to be accurate in quiet regimes. The regime-stratified comparison and the per-regime gradient-norm logs settle this directly. If KalmanNet shows no quiet-regime penalty, the imbalance hypothesis is wrong and we will say so.

Why not just use a classical adaptive filter with innovation covariance matching? In linear systems with slow noise drift, it may well match us. We expect it to lose on two fronts: on abrupt bursts, because a sliding window trades lag against variance, and under model mismatch such as the Lorenz sampling mismatch, where KalmanNet already showed that analytic filters trail by 5–10 dB. We report the regimes where it wins.

Why not just normalize each regime's loss by its known noise variance? In simulation this oracle weighting is available and may equal our method. That is why it is an ablation rather than a strawman. On real data such as NCLT or Blackbird, the regime labels do not exist. Our contribution there is getting the same weighting without them, via the innovation term. If our method falls far short of the oracle, the noise estimator, not the loss, is the bottleneck.

Why not just sum the state and auxiliary losses, as unitary scalarization advises? In Defense of the Unitary Scalarization makes this a legitimate default, so it appears as an explicit condition with matched regularization. The difference is that the imbalance we target lies within a single task across time, not between tasks. No fixed task weight can fix that.

Proposed Experiments

The primary testbed is the chaotic Lorenz attractor with sampling mismatch, as in KalmanNet. Observation noise follows a hidden Markov switch between two to four levels spanning 20–30 dB, with burst durations varied from a few steps to hundreds. We report quiet- and burst-regime MSE in dB, NEES, and the correlation between $\hat R_t$ and the true noise level. For the switching setting there is no reported result on Lacuna, so all numbers will be ours.

The real-data test uses NCLT, where the stationary reference is 22.2 dB for KalmanNet and 25.3 dB for the classical filter. We inject recorded-style bursts into the odometry and GPS channels and also evaluate on the unmodified data, to confirm no stationary regression.

Blackbird (The Blackbird Dataset) tests transfer to aggressive flight, where drift grows with speed. We compare ATE against an AirIO-style learned-velocity filter. AirIO reports a 73.9% ATE reduction relative to global-frame models, but no absolute per-sequence value is given in the file. Latency is measured per step on the same hardware for every method.

The decisive check is the ablation pair on switching Lorenz: the same architecture trained with squared error versus with likelihood. If the likelihood version does not close the quiet-versus-burst gap, or closes it only by sacrificing burst accuracy, the core claim fails. A second decisive check is the innovation-only training run. If it recovers most of the supervised filter's accuracy, the method also reduces the ground-truth requirement that limits current hybrid filters.