TL;DR
This paper investigates whether Mamba, a new State-Space Model (SSM), can effectively perform in-context learning (ICL) on prompts containing mixtures of different tasks, a capability crucial for real-world applications. The study finds that Mamba not only matches Transformer performance on these mixed tasks but also converges faster and handles longer contexts more robustly, suggesting its potential as a more efficient alternative for complex ICL scenarios.
What Problem Does This Paper Address?
In-context learning (ICL) allows large language models to adapt to new tasks by simply observing a few input-output examples within a prompt, without any explicit retraining. While Transformers have shown strong ICL capabilities, their computational cost, especially with long contexts, is a concern. State-Space Models (SSMs), particularly Mamba, offer a linear-time alternative and have demonstrated competitive ICL performance on single tasks. However, a critical unanswered question is whether these SSMs can handle the complexity of prompts that interleave multiple distinct tasks, a common scenario in real-world applications. This paper aims to bridge this gap by evaluating Mamba's ICL performance on task mixtures and comparing it against Transformers.
Methods
The researchers explore Mamba's ICL capabilities across three types of task mixtures:
- Vanilla task mixture: Each prompt sequence contains examples from a single task, but different prompt sequences are assigned different tasks (e.g., noisy linear regression, ReLU regression, or binary classification).
- Concatenated task mixture: Prompt sequences are divided into blocks, with each block assigned a random task type.
- Blended task mixture: Input-output pairs within a single prompt sequence are randomly sampled from a mix of different task functions.
They also investigate three labeling strategies: no labels, prompt labeling (labeling only the first example after a task transition), and embedding labeling (labeling all examples). The study compares Mamba with a small GPT-2 model, evaluating their performance on test risk (for regression tasks) and accuracy (for classification tasks).
Datasets
The paper does not introduce new datasets. Instead, it generates synthetic data for three task families:
- Noisy linear regression: $y = \mathbf{w}^T\mathbf{x} + z$, where $z$ is random noise.
- ReLU regression: $y = (\mathbf{w}^T\mathbf{x})^+$.
- Binary classification: $y = \text{sgn}(\mathbf{w}^T\mathbf{x})$.
Input features ($\mathbf{x}$) and weight parameters ($\mathbf{w}$) are sampled from a normal distribution. The experiments use a dimensionality of $d=5$ and a noise variance of $\sigma^2=0.1$.
Key Insights and Ideas
- Mamba handles task mixtures effectively: Mamba demonstrates a strong ability to learn from prompts containing mixed tasks, achieving performance comparable to Transformer baselines.
- Faster and more stable convergence: Mamba converges significantly faster and exhibits more stable performance during training compared to GPT-2, especially in more complex mixture scenarios. This suggests Mamba might be more efficient for training and inference.
- Robustness to longer contexts: Mamba shows superior generalization to longer context lengths, outperforming GPT-2, which struggles with extrapolation in certain labeling scenarios. This highlights Mamba's potential advantage in handling extended and complex prompts.
- Learning dynamics differ: The study observes distinct learning dynamics for different tasks within mixtures, with noisy linear regression and ReLU tasks converging faster than binary classification. This suggests a hierarchy of learning difficulty.
- Labeling is crucial: Explicit labeling (prompt or embedding) significantly enhances ICL performance for both Mamba and GPT-2, especially in more challenging blended task mixtures, underscoring the importance of task identification.
Key Results
- In vanilla ICL mixtures, Mamba's performance closely matches GPT-2 and aligns with single-task baselines across all labeling methods.
- In concatenated ICL mixtures, Mamba again performs comparably to GPT-2. Labeling methods improve performance, and Mamba consistently converges faster than GPT-2. GPT-2 exhibits a peculiar plateau-then-improvement behavior, unlike Mamba's continuous learning.
- In blended ICL mixtures, Mamba shows continued effectiveness. While GPT-2's performance can decline with more in-context samples (especially with prompt labeling), Mamba's performance continues to improve, indicating better generalization.
- Mamba's convergence rates for noisy linear regression and ReLU tasks are around 20k-30k iterations, while binary classification takes about 40k iterations. GPT-2's training dynamics show a distinct "plateau then improve" pattern.
Limitations and Future Work
- Limitations: The study uses small GPT-2 and Mamba models. The performance of larger models, especially in more complex real-world scenarios, is not explored. The synthetic nature of the datasets might not fully capture the nuances of real-world task mixtures.
- Future Work: The authors suggest exploring the scalability of Mamba's rapid convergence across extensive ICL task mixtures. They also propose investigating the potential benefits of adopting hybrid architectures that combine SSMs and Transformers.
Summary updated