All models

s4_layer

Structured state space layer for long sequences, built on an efficiently computed state space model.

Time series · 25 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (26 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
2.7K
Operations
25
Framework
PyTorch
Recurrent
No
Published
2021
Authors
Albert Gu, Karan Goel, Christopher Ré
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m12114
Graph hash
319c8d91bd90d51a6f2498d7fabff4f5bb11c9653b64b9cf7f1fe309df7b7ae5
Skeleton hash
8969b85634308913517c2b81cd9ce546e0ea3b92739fd32fd244c246091bbe5e
Architecture hash
82c52d823139d8b5a37a4d9d1acc662df9d6ef226351cfe82e13750be427e696
Diagram SHA-256
153543e886c2f9ec4744c8335d5f274e5586637022220500765dcd414e9d5dd2
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

menagerie.classics.ssm_s4:build_s4_layer: build({})

What it is

S4, the Structured State Space sequence model, is a sequence layer built on the state space model (SSM), a system whose matrices A, B, C and D map an input signal to an output through a latent state. Its target is long-range dependencies: the paper notes that RNNs, CNNs and Transformers still struggle to scale to very long sequences of 10000 or more steps.

An earlier SSM approach showed that the right choice of state matrix A could handle long-range dependencies, but it had prohibitive computation and memory requirements. S4 conditions A with a low-rank correction, which allows it to be diagonalized stably and reduces the SSM to the computation of a Cauchy kernel. An S4 layer starts from an SSM with A set to the HiPPO matrix. Compared to the earlier Linear State Space Layer (LSSL), the paper reports S4 as up to 30× faster with 400× less memory usage.

Among the paper's results is 91% accuracy on sequential CIFAR-10 with no data augmentation or auxiliary losses. The core S4 module is a linear transformation, and the authors describe the overall deep S4 model as closely related to a depthwise-separable CNN but with global convolution kernels.

Key idea. The paper proposes S4, a new parameterization of the state space model that can be computed much more efficiently than prior approaches while preserving their theoretical strengths.

  • S4
  • Structured State Space sequence model
  • structured state spaces
  • S4 layer
  • state space model
  • SSM
  • long sequences
  • long-range dependencies
  • Long Range Arena

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{gu2022efficientlymodelinglongsequences,
      title={Efficiently Modeling Long Sequences with Structured State Spaces}, 
      author={Albert Gu and Karan Goel and Christopher Ré},
      year={2022},
      eprint={2111.00396},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2111.00396}, 
}