Papers › Efficiently Modeling Long Sequences with Structured State Spaces

Efficiently Modeling Long Sequences with Structured State Spaces

31 Oct 2021ICLR 2022 4arXiv:2111.00396archive 2025-07-28

Albert Gu, Karan Goel, Christopher Ré

A central goal of sequence modeling is designing a single principled model that can address sequence data across a range of modalities and tasks, particularly on long-range dependencies. Although conventional models including RNNs, CNNs, and Transformers have specialized variants for capturing long dependencies, they still struggle to scale to very long sequences of $10000$ or more steps. A promising recent approach proposed modeling sequences by simulating the fundamental state space model (SSM) x′(t) = Ax(t) + Bu(t), y(t) = Cx(t) + Du(t), and showed that for appropriate choices of the state matrix A, this system could handle long-range dependencies mathematically and empirically. However, this method has prohibitive computation and memory requirements, rendering it infeasible as a general sequence modeling solution. We propose the Structured State Space sequence model (S4) based on a new parameterization for the SSM, and show that it can be computed much more efficiently than prior approaches while preserving their theoretical strengths. Our technique involves conditioning A with a low-rank correction, allowing it to be diagonalized stably and reducing the SSM to the well-studied computation of a Cauchy kernel. S4 achieves strong empirical results across a diverse range of established benchmarks, including (i) 91\% accuracy on sequential CIFAR-10 with no data augmentation or auxiliary losses, on par with a larger 2-D ResNet, (ii) substantially closing the gap to Transformers on image and language modeling tasks, while performing generation 60× faster (iii) SoTA on every task from the Long Range Arena benchmark, including solving the challenging Path-X task of length 16k that all prior work fails on, while being as efficient as all competitors.

PaperPDFConference PDFCodeCode 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="2111.00396")

Code

Syntology Ran 28 of 55 code samples harvested from 8 repositories linked to this paper; 27 have no recorded run. Of those that ran: 2 ran · honoured contract; 1 ran · violated contract; 11 ran · our draft was wrong; 2 ran · fixture could not drive it; 12 ran with no contract checked.

By repository: official repository: 10 samples from 1 repository, 5 ran; community (archive-listed): 42 samples from 6 repositories, 20 ran; community: 2 samples from 1 repository, 2 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

state-spaces/s4 officialmentioned on GitHubpytorch report
ag1988/dss mentioned on GitHubpytorch report
elgazzarr/fmri-s4 mentioned on GitHubpytorch report
forgi86/lru-reduction mentioned on GitHubjax report
leonty1/essm mentioned on GitHubpytorch report
maxtimer97/ssm-inspired-lif mentioned on GitHubpytorch report
nicolaszucchet/minimal-lru mentioned on GitHubjax 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

55 samples harvested; 28 ran; 2 honoured the contract we drafted; 27 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.

2ran · honoured contract
1ran · violated contract
11ran · our draft was wrong
2ran · fixture could not drive it
12ran
27unverified

Licence: 3 of the 55 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 8 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “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.

Kernel state-spaces/s4/models/s4/s4.py official repository ran Apache-2.0 (permissive) · 855fe49867900076 · report
SSMKernel state-spaces/s4/models/s4/s4.py official repository ran Apache-2.0 (permissive) · a0aad68e21728b6a · report
cauchy_naive state-spaces/s4/models/s4/s4.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · b7d9d94554e93b1b · report
log_vandermonde_naive state-spaces/s4/models/s4/s4.py official repository ran · our draft was wrong Apache-2.0 (permissive) · e25911109ba29783 · report
nplr state-spaces/s4/models/s4/s4.py official repository ran · our draft was wrong Apache-2.0 (permissive) · d43b03a2d76a4e41 · report
SSMKernelDPLR state-spaces/s4/models/s4/s4.py official repository unverified Apache-2.0 (permissive) · 2e1521f562fb37ea · report
SSMKernelDiag state-spaces/s4/models/s4/s4.py official repository unverified Apache-2.0 (permissive) · b2fe7789636402f0 · report
combination state-spaces/s4/models/s4/s4.py official repository unverified Apache-2.0 (permissive) · 7564850110a688c1 · report
dplr state-spaces/s4/models/s4/s4.py official repository unverified Apache-2.0 (permissive) · 9eb8abe7e31d874d · report
ssm state-spaces/s4/models/s4/s4.py official repository unverified Apache-2.0 (permissive) · 64dd93f539b06f8e · report
LRU nicolaszucchet/minimal-lru/lru/model.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 6e1825a893399540 · report
LinearActivation elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 522a1fc1276ec144 · report
LinearActivation leonty1/essm/src/models/sequence/ss/standalone/dss.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 6c960a9598a04692 · report
S4D maxtimer97/ssm-inspired-lif/models/snns.py community (archive-listed) ran no licence file found · pointer only · 9d310a2394e754b7 · report
S4DKernel maxtimer97/ssm-inspired-lif/models/snns.py community (archive-listed) ran no licence file found · pointer only · 1f674b4ed2ecc8cd · report
SE_Block elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · a19e25de29fbaae4 · report
TransposedLinear elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 5a5e28e0e6ccd2d2 · report
TransposedLinear leonty1/essm/src/models/sequence/ss/standalone/dss.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · 7bbdbc08ffa75119 · report
_interleave forgi86/lru-reduction/lru/linear.py community (archive-listed) ran fingerprinted MIT (permissive) · 95f2fb2164162bdd · report
associative_scan forgi86/lru-reduction/lru/linear.py community (archive-listed) ran MIT (permissive) · 22730030e03982a4 · report
binary_operator_diag forgi86/lru-reduction/lru/linear.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · a6aaaac22e971146 · report
embed_c2r elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · ada726a93c0d5dfc · report
hippo_skew_evals leonty1/essm/src/models/sequence/ss/standalone/dss.py community (archive-listed) ran · violated contract fingerprinted Apache-2.0 (permissive) · 818366932a065b68 · report
linear elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · f1cab21ec84db199 · report
nplr elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 63d9be34f73a43ef · report
power elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 348275db42a37bee · report
rank_correction elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · honoured contract MIT (permissive) · b719a3ec912becb6 · report
reciprocal leonty1/essm/src/models/sequence/ss/standalone/dss.py community (archive-listed) ran · fixture could not drive it fingerprinted Apache-2.0 (permissive) · e6971caf5e1cc5c1 · report
slice_along_axis forgi86/lru-reduction/lru/linear.py community (archive-listed) ran fingerprinted MIT (permissive) · 34b3f63a52000df0 · report
transition elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 81a948ed6d1a963f · report
DSS leonty1/essm/src/models/sequence/ss/standalone/dss.py community (archive-listed) unverified Apache-2.0 (permissive) · f3322f19b651f88b · report
DSSKernel leonty1/essm/src/models/sequence/ss/standalone/dss.py community (archive-listed) unverified Apache-2.0 (permissive) · e604fd0087c1b8f3 · report
DefaultMNIST srush/annotated-s4/s4/sample.py community (archive-listed) unverified MIT (permissive) · e4f2a7408ee25578 · report
HippoSSKernel elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) unverified MIT (permissive) · 5c8e4f0e400a4956 · report
LRU forgi86/lru-reduction/lru/linear.py community (archive-listed) unverified MIT (permissive) · 0d14eeb8e803d789 · report
OptimModule leonty1/essm/src/models/sequence/ss/standalone/dss.py community (archive-listed) unverified Apache-2.0 (permissive) · 67c82b9a05adebd0 · report
S4 elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) unverified MIT (permissive) · 7d9920a7ef12302c · report
SSKernelNPLR elgazzarr/fmri-s4/src/models/sequence/ss/standalone/s4.py community (archive-listed) unverified MIT (permissive) · 29e51ca431baa365 · report
cauchy srush/annotated-s4/s4/memory_bug.py community (archive-listed) unverified MIT (permissive) · b294cd8cde986e7e · report
complex_softmax srush/annotated-s4/s4/dss.py community (archive-listed) unverified MIT (permissive) · b895231ad0d7eb03 · report
create_mnist_dataset srush/annotated-s4/s4/data.py community (archive-listed) unverified MIT (permissive) · 200d610a7e1bda69 · report
create_sin_ax_b_dataset srush/annotated-s4/s4/data.py community (archive-listed) unverified MIT (permissive) · a9f0a96fb976b6ac · report
create_sin_x_dataset srush/annotated-s4/s4/data.py community (archive-listed) unverified MIT (permissive) · d637a7237715e2ea · report
discretize srush/annotated-s4/s4/s4.py community (archive-listed) unverified MIT (permissive) · 2fbdf4a5c125f869 · report
discretize srush/annotated-s4/s4/s4d.py community (archive-listed) unverified MIT (permissive) · c29c5241ff1d2f5a · report
dlyap_torch_direct_diagonal forgi86/lru-reduction/lru/linear.py community (archive-listed) unverified MIT (permissive) · fbd06741252dd8e2 · report
dss_kernel srush/annotated-s4/s4/dss.py community (archive-listed) unverified MIT (permissive) · 48664b31b86bdb2f · report
dss_ssm srush/annotated-s4/s4/dss.py community (archive-listed) unverified MIT (permissive) · 12ff0e50a74997cf · report
random_SSM srush/annotated-s4/s4/s4.py community (archive-listed) unverified MIT (permissive) · 5b97d5371e044049 · report
s4d_kernel srush/annotated-s4/s4/s4d.py community (archive-listed) unverified MIT (permissive) · 2cebc3a83a8c3bc5 · report
scan_SSM srush/annotated-s4/s4/s4.py community (archive-listed) unverified MIT (permissive) · f78db7b4e91ceafa · report
vandermonde_product srush/annotated-s4/s4/s4d.py community (archive-listed) unverified MIT (permissive) · 002674cddd8530fd · report
Activation raminmh/liquid-s4/src/models/s4/s4.py community ran · our draft was wrong Apache-2.0 (permissive) · 89b10a8b26bbb7ed · report
LinearActivation raminmh/liquid-s4/src/models/s4/s4.py community ran · our draft was wrong Apache-2.0 (permissive) · 898daef1784ec4bd · report
get_initializer identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · f3449af8fae1d130 · report

Tasks

Data AugmentationLanguage ModelingLanguage ModellingListOpsLong-range modelingSequential Image ClassificationSpeech Recognition

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Language Modelling WikiText-103 S4 Number of params 249M #45 of 89 Archive leaderboard report
Language Modelling WikiText-103 S4 Test perplexity 21.28 #45 of 89 Archive leaderboard report
Sequential Image Classification Sequential CIFAR-10 S4 Unpermuted Accuracy 91.80% #2 of 13 Archive leaderboard report
Sequential Image Classification Sequential MNIST S4 Permuted Accuracy 98.70% #4 of 30 Archive leaderboard report
Sequential Image Classification Sequential MNIST S4 Unpermuted Accuracy 99.63% #4 of 30 Archive leaderboard report
Speech Recognition Speech Commands S4 Accuracy (%) 98.32 #3 of 3 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

1x1 ConvolutionAverage PoolingBatch NormalizationBottleneck Residual BlockConvolutionGlobal Average PoolingKaiming InitializationMax PoolingReLUResidual BlockResidual Connection

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