Skip to main content
QUICK REVIEW

[Paper Review] Is Mamba Capable of In-Context Learning?

Riccardo Grazzi, Julien Siems|arXiv (Cornell University)|Feb 5, 2024
Education and Technology IntegrationSocial Sciences5 citations
TL;DR

The paper provides empirical evidence that Mamba, a selective structured state space model, matches transformers in in-context learning (ICL) across simple function tasks and NLP benchmarks, and may offer an efficient alternative for long-input sequences.

ABSTRACT

State of the art foundation models such as GPT-4 perform surprisingly well at in-context learning (ICL), a variant of meta-learning concerning the learned ability to solve tasks during a neural network forward pass, exploiting contextual information provided as input to the model. This useful ability emerges as a side product of the foundation model's massive pretraining. While transformer models are currently the state of the art in ICL, this work provides empirical evidence that Mamba, a newly proposed state space model which scales better than transformers w.r.t. the input sequence length, has similar ICL capabilities. We evaluated Mamba on tasks involving simple function approximation as well as more complex natural language processing problems. Our results demonstrate that, across both categories of tasks, Mamba closely matches the performance of transformer models for ICL. Further analysis reveals that, like transformers, Mamba appears to solve ICL problems by incrementally optimizing its internal representations. Overall, our work suggests that Mamba can be an efficient alternative to transformers for ICL tasks involving long input sequences. This is an exciting finding in meta-learning and may enable generalizations of in-context learned AutoML algorithms (like TabPFN or Optformer) to long input sequences.

Motivation & Objective

  • Demonstrate whether Mamba can perform in-context learning (ICL) across simple function classes and NLP tasks.
  • Compare Mamba’s ICL performance to transformer baselines and relevant SSM variants (S4) and RWKV.
  • Investigate mechanisms by which Mamba solves ICL, including incremental internal representation optimization.
  • Assess scalability of Mamba ICL with increasing context length and model size.

Proposed method

  • Train Mamba and baselines on simple regression task distributions (linear, skewed LR, Noisy LR, random quadrants) and compare to GPT-2/Transformer, S4, RWKV under matched parameter counts.
  • Evaluate ICL performance on simple function classes and assess in-distribution vs out-of-distribution generalization.
  • Use a probing strategy to analyze whether Mamba solves ICL via iterative optimization similar to transformers, including linear probes over intermediate representations.
  • Pre-train and fine-tune Mamba language models of varying sizes (130M to 2.8B params) on Pile; compare ICL performance to RWKV and common transformers on Hendel et al. NLP tasks.
(a) Skewed LR
(a) Skewed LR

Experimental results

Research questions

  • RQ1Can Mamba match transformer-level ICL performance on simple regression tasks and extrapolate to longer input sequences?
  • RQ2Does Mamba exhibit ICL via incremental internal representation optimization similar to transformers?
  • RQ3How does Mamba's ICL performance scale with model size and context length on NLP benchmarks?

Key findings

  • Mamba matches transformer performance on ICL for several simple function classes and NLP tasks.
  • Mamba outperforms S4 and RWKV baselines in ICL across tested settings.
  • Probing suggests Mamba and transformers employ iterative optimization-like mechanisms to refine solutions during ICL.
  • ICL performance improves with larger Mamba models and longer context in NLP tasks.
  • Mamba shows strong extrapolation to longer inputs in linear regression and maintains competitive accuracy across NLP benchmarks.
(b) Noisy LR
(b) Noisy LR

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.