Papers › Can Mamba Learn How to Learn? A Comparative Study on In-Context Learning Tasks

Can Mamba Learn How to Learn? A Comparative Study on In-Context Learning Tasks

6 Feb 2024arXiv:2402.04248archive 2025-07-28

Jongho Park, Jaeseung Park, Zheyang Xiong, Nayoung Lee, Jaewoong Cho, Samet Oymak, Kangwook Lee, Dimitris Papailiopoulos

State-space models (SSMs), such as Mamba (Gu & Dao, 2023), have been proposed as alternatives to Transformer networks in language modeling, by incorporating gating, convolutions, and input-dependent token selection to mitigate the quadratic cost of multi-head attention. Although SSMs exhibit competitive performance, their in-context learning (ICL) capabilities, a remarkable emergent property of modern language models that enables task execution without parameter optimization, remain underexplored compared to Transformers. In this study, we evaluate the ICL performance of SSMs, focusing on Mamba, against Transformer models across various tasks. Our results show that SSMs perform comparably to Transformers in standard regression ICL tasks, while outperforming them in tasks like sparse parity learning. However, SSMs fall short in tasks involving non-standard retrieval functionality. To address these limitations, we introduce a hybrid model, MambaFormer, that combines Mamba with attention blocks, surpassing individual models in tasks where they struggle independently. Our findings suggest that hybrid architectures offer promising avenues for enhancing ICL in language models.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2402.04248")

Code

Syntology Ran 9 of 14 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 1 ran · violated contract; 8 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 9 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

krafton-ai/mambaformer-icl officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
hazyresearch/based mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested; 9 ran; 0 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
8ran
5unverified

Licence: 0 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from krafton-ai/mambaformer-icl. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

basic_plot krafton-ai/mambaformer-icl/src/plot_utils.py official repository ran Apache-2.0 (permissive) · 5b74687909baf467 · report
generate_dummy_vector krafton-ai/mambaformer-icl/src/filtering_utils.py official repository ran fingerprinted Apache-2.0 (permissive) · b1c1ac424117b8de · report
mean_squared_error krafton-ai/mambaformer-icl/src/tasks.py official repository ran fingerprinted Apache-2.0 (permissive) · fc94f27a0973e093 · report
orthogonalize krafton-ai/mambaformer-icl/src/filtering_utils.py official repository ran fingerprinted Apache-2.0 (permissive) · a46d1c2a317b35c5 · report
squared_error krafton-ai/mambaformer-icl/src/tasks.py official repository ran fingerprinted Apache-2.0 (permissive) · 348d63a78eb4cb94 · report
squared_norm_error krafton-ai/mambaformer-icl/src/tasks.py official repository ran fingerprinted Apache-2.0 (permissive) · b4326d9d300aa5c0 · report
str2bool krafton-ai/mambaformer-icl/src/util.py official repository ran · violated contract Apache-2.0 (permissive) · 8605dc8a088f3db8 · report
train_step krafton-ai/mambaformer-icl/src/train_parallel.py official repository ran Apache-2.0 (permissive) · 47f61861b53edf4d · report
zero_pad_ys krafton-ai/mambaformer-icl/src/filtering_utils.py official repository ran Apache-2.0 (permissive) · 75e826964a91f44b · report
get_data_sampler krafton-ai/mambaformer-icl/src/samplers.py official repository unverified Apache-2.0 (permissive) · 54f3966e15e1afe1 · report
get_final_var krafton-ai/mambaformer-icl/src/curriculum.py official repository unverified Apache-2.0 (permissive) · 3c24ac252fef0868 · report
randperm_2d_with_query krafton-ai/mambaformer-icl/src/samplers.py official repository unverified Apache-2.0 (permissive) · ddd35c92ba9c2871 · report
sample_seeds krafton-ai/mambaformer-icl/src/train_parallel.py official repository unverified Apache-2.0 (permissive) · 4d49c710f74c99c4 · report
sample_transformation krafton-ai/mambaformer-icl/src/samplers.py official repository unverified Apache-2.0 (permissive) · 7f92ad21604fa243 · report

Tasks

In-Context LearningLanguage ModelingLanguage ModellingMambaRetrievalState Space Models

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections