TL;DR
KalMamba bridges the gap between scalable deterministic State Space Models (SSMs) like Mamba and uncertainty-aware probabilistic world models for reinforcement learning. By using Mamba to predict the transition parameters of a latent linear-Gaussian SSM and executing Kalman filtering and smoothing via parallel associative scans, KalMamba achieves near-logarithmic runtime scaling with sequence length while retaining the robust uncertainty estimation needed for noisy, partially observable environments.
What Problem Does This Paper Address?
Reinforcement learning (RL) in real-world scenarios—such as high-frequency robotics or non-stationary manipulation—requires models that can simultaneously:
- Handle long sequences of interactions without hitting memory or computation bottlenecks.
- Quantify uncertainty arising from noisy, partial, or missing observations.
Recent deep probabilistic SSMs (such as Dreamer's RSSM or the Variational Recurrent Kalman Network, VRKN) excel at capturing uncertainty through stochastic latent spaces. However, their inference processes are strictly recurrent and autoregressive, forcing sequential computations that scale linearly ($O(T)$) in wall-clock time and choke on long sequences.
Conversely, modern deterministic SSMs (like S4 and Mamba) process massive contexts in parallel using associative scans. However, they lack principled probabilistic formulations, struggle to quantify belief state uncertainty, and cannot easily perform bidirectional smoothing without sacrificing efficiency.
KalMamba asks: Can we combine Mamba’s parallel scalability with the principled uncertainty tracking of Kalman filtering and smoothing?
Methods
KalMamba embeds a time-varying, linear-Gaussian SSM into a latent space and computes exact belief states in parallel:
- Mamba Dynamics Backbone: Rather than linearizing dynamics autoregressively around past latent states, KalMamba feeds encoded observation-action histories into a Mamba sequence model. Mamba outputs an intermediate representation $m_t$, from which small neural networks emit the transition parameters (transition matrix $A_t$, bias $b_t$, and diagonal covariance $\Sigma_t^{\text{dyn}}$) for each timestep.
- Time-Parallel Kalman Filtering & Smoothing: Because the latent system is linear-Gaussian conditioned on Mamba's outputs, belief state inference reduces to Kalman filtering and Rauch–Tung–Striebel (RTS) smoothing. Crucially, the authors formulate these Kalman operations as associative operators, computing both filtering and smoothing in parallel using associative prefix scans on GPUs. With diagonal covariance matrices, operations become fast point-wise calculations.
- Variational Smoothing Objective: Models are trained end-to-end using VRKN's tight smoothing ELBO (variational lower bound), which conditions on past and future observations.
- Information Bottleneck & Regularization: To prevent Mamba from bypassing the latent Kalman state, the authors regularize $m_t$ towards the filtered belief mean $\mu_t^+$ using a Mahalanobis distance penalty. Monte-Carlo Dropout is added to capture epistemic uncertainty.
- Downstream Control: Soft Actor-Critic (SAC) is trained directly on top of the variational filtered belief state $\mu_t^+$, sidestepping expensive latent rollout simulations during policy updates.
Observations & Actions ──> Mamba Backbone ──> Predicted Dynamics (A_t, b_t, Σ_t)
│
Parallel Associative Scan
▼
Policy (SAC) <── Filtered Belief q(z_t|o_≤t) <── Parallel Kalman Filter & Smoother
│
▼
Loss / Updates <──────────────────────────── Smoothed Belief q(z_t|o_≤T)
Datasets
The authors evaluate on continuous control benchmarks from the DeepMind Control (DMC) Suite:
- Four representative environments:
cartpole_swingup,quadruped_walk,walker_walk, andwalker_run. - Image-based benchmark: Standard pixel-based observations.
- Noisy state-based benchmark: Low-dimensional states corrupted by adding zero-mean Gaussian observation noise $\mathcal{N}(0, 0.3)$ to observations and invisible dynamics noise $\mathcal{N}(0, 0.3)$ directly into environment actions.
Key Insights and Ideas
- Decoupling Context Processing from Belief Inference: Instead of running complex non-linear probabilistic filtering sequentially, KalMamba delegates history aggregation to a parallel deterministic Mamba block, leaving the latent state transition linear-Gaussian.
- Parallel Associative Filtering in Deep RL: While parallel Bayesian smoothers exist mathematically, KalMamba is the first architecture to integrate GPU-accelerated parallel Kalman filtering/smoothing directly into a deep generative world model for RL.
- Preventing "SSM Bypass" via Mahalanobis Regularization: High-capacity backbones like Mamba can trivially memorize trajectories and bypass the latent Kalman filter. Forcing the intermediate representations to align with the Kalman filter's uncertainty-weighted belief mean is critical for learning stable representations.
Key Results
- Near-Logarithmic Wall-Clock Scaling: For training sequence lengths from $T=8$ up to $T=2048$, KalMamba exhibits near-flat (near-logarithmic) execution time per forward pass and training batch, while baseline methods (RSSM, VRKN) scale strictly linearly.
- Long Sequence Robustness: On noisy
walker_walkat sequence length 256, VRKN timed out (taking over 24 hours to reach only 650k steps), and RSSM's performance degraded. KalMamba completed 1M steps in roughly 5 hours, achieving superior performance that improved as context length increased. - Competitive RL Performance:
- Pixel tasks: Matches or comes within close margin of VRKN, RSSM+SAC, and DreamerV3 across all tasks.
- Noisy state tasks: Strongly outperforms baseline RSSM and vanilla SAC, approaching the performance of the computationally heavier VRKN.
Limitations and Future Work
- Evaluation Scope: Experiments are limited to four DMC benchmark tasks; validation on high-frequency, complex multi-modal robotics tasks remains future work.
- Baseline Coverage: KalMamba was not compared head-to-head against recent non-smoothing, deterministic-backbone world models (e.g., Recall-to-Image / R2I).
- Linear Expressiveness: Dynamics matrices are restricted to diagonal, real-valued matrices. The authors propose extending latent states to complex numbers to capture richer, oscillatory dynamics.
- Hardware Optimization: Current parallel scans rely on native PyTorch routines; writing dedicated fused CUDA/Triton kernels (akin to official Mamba implementations) could deliver even larger hardware speedups.
Summary updated