All models

Gated State Spaces (GSS)

A language model built from Gated State Space layers, a gated state space alternative to attention.

Language · 578 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 (30 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
225M
Operations
578
Framework
PyTorch
Recurrent
No
Published
ICLR 2023
Cited by
70 (as of 28 October 2026)
Authors
Harsh Mehta, Ankit Gupta, Ashok Cutkosky, Behnam Neyshabur
License
MIT
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
m17013
Graph hash
acbdd2aef35eef0497d98e37332ef9d1ea50a32dac0c4ca7c7bcfff5d0a0180a
Skeleton hash
6ac6deaeb7f6bcc5dc29f3d0736c21965b42ac41b4f99203b3cc95296a30471b
Architecture hash
8c758ceb345f486d0ad4cd5ad740877dbbc32dafbd79255ccf82d1c9afff1f7e
Diagram SHA-256
f4517c6db1c4a772438974bae35ab9fa42e1682b1960be648984648673e6c128
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

Gated State Space (GSS) is a layer for autoregressive sequence modeling, which its paper studies over English books, Github source code and ArXiv mathematics articles. The authors found that earlier state space models such as S4 and DSS ran slower in training than they expected.

GSS builds on the Gated Attention Unit and replaces its attention with a further simplified DSS layer. The gating units reduce the dimensionality of the FFT operations, which the authors had observed to be the main bottleneck behind slow training. The paper reports the layer to be 2-3× faster than DSS while keeping the perplexity on several language modeling benchmarks. The authors also report training the model successfully with randomly initialized state space variables.

The code behind this page is a PyTorch implementation of Gated State Spaces. The paper's GSS model has 16 layers and an embedding dimension of 1024. Its models use no explicit position embedding or bias, since GSS layers are position aware. The paper also describes a hybrid that sparingly interleaves traditional Transformer blocks with GSS layers. Trained on sequences of at most 4k tokens, the GSS variants were evaluated on lengths up to 65k, and the paper reports consistent generalization to longer inputs.

Key idea. The paper proposes the Gated State Space layer, which uses gating units to reduce the dimensionality of a state space model's FFT operations and trains 2-3× faster than DSS.

  • Gated State Spaces
  • GSS
  • Gated State Space
  • long range language modeling
  • state space model
  • language model
  • autoregressive sequence modeling
  • long sequences

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

Cite the paper

@misc{mehta2022longrangelanguagemodeling,
      title={Long Range Language Modeling via Gated State Spaces}, 
      author={Harsh Mehta and Ankit Gupta and Ashok Cutkosky and Behnam Neyshabur},
      year={2022},
      eprint={2206.13947},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2206.13947}, 
}