TL;DR
State Space Models (SSMs) like Mamba are powerful, efficient alternatives to Transformers, but standard fine-tuning techniques ignore their unique temporal dynamics. This paper introduces Memba, a Parameter-Efficient Fine-Tuning (PEFT) method that injects bio-inspired "membrane" neurons into Mamba's gating mechanism. By adding temporal memory to the gates without altering the fragile pre-trained SSM core, Memba achieves state-of-the-art fine-tuning performance across both language and vision tasks.
The Challenge: Fine-Tuning State Space Models
As large language and vision models scale up, full fine-tuning becomes computationally prohibitive. Parameter-Efficient Fine-Tuning (PEFT) methods—like LoRA—solve this by freezing most of the model and training only a tiny subset of weights.
However, current PEFT methods were designed for Transformers and fall short when applied to SSMs like Mamba. Mamba processes sequences differently, relying on a delicate, mathematically balanced state-space core. Previous studies show that directly fine-tuning this core often degrades performance. Furthermore, Mamba's standard gating mechanism (which controls information flow) is a simple linear transformation lacking the sophisticated, time-aware memory found in older recurrent networks. The central question is: How can we effectively adapt Mamba's temporal processing to new tasks without breaking its pre-trained dynamics?
Introducing Memba
The authors propose Memba, which leaves the core SSM math alone and instead upgrades the model's gating branch. It relies on three key components:
- Leaky Integrate Membrane (LIM) Neurons: Inspired by biological spiking neurons, Memba replaces standard linear gating with LIM neurons. As sequence tokens pass through, these neurons "accumulate" a membrane potential. If the potential crosses a threshold, it resets. It also "leaks" over time, allowing the model to naturally forget old, irrelevant information. To maintain efficiency, sequences are processed in parallel chunks.
- Strategic LoRA Placement: Instead of applying Low-Rank Adaptation (LoRA) everywhere, Memba strategically applies it only to the input and output projection layers. This keeps the trainable parameter count incredibly low.
- Cross-Layer Membrane Transfer: To maintain temporal context deep into the network, the average membrane potential from one layer is passed forward to initialize the membrane state of the next layer.
Key Insights and Results
The authors evaluated Memba across diverse domains, including 8 Commonsense reasoning benchmarks for language, the Visual Task Adaptation Benchmark (VTAB-1k) for vision, and the Long Range Arena (LRA) for long-range sequence modeling.
- Language Performance: On the Mamba-790M model, Memba achieved an average accuracy of 52.3% across reasoning tasks, outperforming standard LoRA (50.8%) and other Mamba-specific PEFT methods. It even outperformed full fine-tuning (51.6%) while updating only a fraction of the weights.
- Vision Performance: Using the Vision Mamba (Vim-S) architecture, Memba achieved 72.33% average accuracy on VTAB-1k. It surpassed previous hybrid fine-tuning methods while using only 28% of the trainable parameters.
- Free Temporal Processing: The LIM neuron adds sophisticated temporal memory to Mamba's gating mechanism without adding a single learnable parameter. It outperforms parameter-heavy LSTM or GRU gates simply through its inherent leaky-integrate dynamics.
- Built-in Regularization: The fluctuations caused by the membrane's reset mechanism act as an adaptive regularizer. Empirically, this results in a smoother, more convex loss landscape, helping the model generalize better and avoid sharp, unstable local minima.
Limitations and Future Work
Because the LIM neuron relies on recurrent accumulation and reset mechanisms, it introduces an ~8.8% inference latency overhead compared to standard Mamba with LoRA. Additionally, storing membrane potentials across layers requires about 12-14% more GPU memory during training. However, the authors note that writing custom, fused CUDA kernels could parallelize the intra-chunk operations in the future, potentially reducing this computational overhead to near zero.
Summary updated