Overview
Linear RNNs in lrnnx come in two fundamental flavors that differ in how their dynamics evolve over time:LTI: Linear Time-Invariant
Fixed dynamics - the state transition matrices (A, B, C) are constant across all timesteps
LTV: Linear Time-Varying
Input-dependent dynamics - the state transition matrices change based on the input at each timestep
Linear Time-Invariant (LTI) models
How they work
LTI models use fixed state-space parameters that don’t change during sequence processing:- Recurrent form (inference)
- Convolutional form (training)
LTI models in lrnnx
The library provides several LTI architectures:| Model | Description | Key Features |
|---|---|---|
| S4 | Structured State Space | DPLR parameterization, excellent long-range modeling |
| S4D | Diagonal S4 | Simplified diagonal-only parameterization |
| S5 | Simplified S5 | MIMO design, processes all channels together |
| LRU | Linear Recurrent Unit | Complex-valued diagonal states |
| Centaurus | Efficient variants | Multiple architectural patterns (DWS, Neck, etc.) |
All LTI models in lrnnx extend the
LTI_LRNN base class, which provides the compute_kernel() method for FFT-based training.When to use LTI models
Fixed temporal patterns
Fixed temporal patterns
When your data has consistent dynamics that don’t need to adapt based on content. Examples include:
- Audio waveforms with fixed sampling rates
- Regular time series (weather, sensor data)
- Genomic sequences
Maximum training efficiency
Maximum training efficiency
LTI models can leverage FFT-based convolutions during training, making them extremely fast to train - comparable to or faster than Transformers on long sequences.
Proven stability
Proven stability
LTI models like S4 have well-understood stability guarantees and initialization schemes that ensure reliable long-range modeling out of the box.
Linear Time-Varying (LTV) models
How they work
LTV models compute input-dependent parameters at each timestep:Example: Mamba’s selective mechanism
The exact mechanism varies by model. S6/S7 make different matrices input-dependent compared to Mamba.
LTV models in lrnnx
| Model | Description | Selective Mechanism |
|---|---|---|
| Mamba | Selective State Space | Input-dependent Δ, B, C (S6 variant) |
| S6 | Selective S5 | Input-dependent B, C (original) |
| S7 | Bidirectional S6 | S6 with bidirectional processing |
| RG-LRU | Recurrent Gated LRU | Gated variant of LRU |
| Event-based variants | Async processing | Support variable timesteps for event data |
All LTV models extend the
LTV_LRNN base class and support the integration_timesteps parameter for event-based processing.When to use LTV models
Content-dependent processing
Content-dependent processing
When the model needs to adapt its behavior based on input content:
- Language modeling (focus on important tokens)
- Document understanding (selective information flow)
- Tasks requiring filtering or gating mechanisms
Selective copying and recall
Selective copying and recall
LTV models excel at tasks that require selectively storing and retrieving information, such as:
- Selective copying benchmarks
- In-context learning
- Association recall tasks
Event-based data
Event-based data
LTV models support asynchronous discretization for irregular time series:
- Neuromorphic event streams
- Medical records with irregular timestamps
- Financial tick data
Key differences
- Training
- Inference
- Capabilities
| Aspect | LTI | LTV |
|---|---|---|
| Parallelization | Full (FFT convolution) | Sequential (scan/recurrence) |
| Training speed | Very fast | Moderate (optimized with kernels) |
| GPU utilization | Excellent | Good (with custom kernels) |
Code comparison
Choosing between LTI and LTV
Use this decision tree to guide your choice:Next steps
Discretization
Learn how discretization methods work and which to use
Model Reference
Detailed API documentation for all models
Linear RNNs
Learn the fundamentals of linear RNNs
Examples
See complete examples using LTI and LTV models
