All models

gla_model

Gated linear attention: linear attention with data-dependent gates, usable in place of standard attention.

Language · 242 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 (13 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
68.7K
Operations
242
Framework
PyTorch
Recurrent
No
Published
ICML 2024
Cited by
10 (as of 29 October 2026)
Authors
Songlin Yang, Bailin Wang, Yikang Shen and others
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
m5192
Graph hash
5cf9aa0c0bff8eb24d0c6d6cf8abd3cdb936de4525f17dffaa16b12299d17317
Skeleton hash
8147190bfaf82391b0240b9b69d578a142952c90ab0c39db762b246475ff4af9
Architecture hash
3b9963ee11a8aa45514968dbd69695ceb468f40b535db0c41c611ffe0107dd6b
Diagram SHA-256
25c20fe901adf452c0697eb480e6b9d36e046d5ead9ac39f369a1974aec3b265
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

This model computes gated linear attention as a recurrence, the view in which a linear attention layer is a linear recurrent layer with a matrix-valued hidden state.

About this model's family

The GLA Transformer is a language model that replaces the standard attention layer with gated linear attention (GLA), a variant of linear attention with data-dependent gates. Linear attention can be trained in parallel but can also be written as an RNN with a matrix-valued hidden state, which gives linear-time inference.

Earlier variants such as RetNet multiply the hidden state by a single global decay factor that does not depend on the data. GLA computes its gate from the input instead, using a low-rank linear layer followed by a sigmoid. In the multi-head layer, LayerNorm is applied after each head's output, and the output projection and output gating operate on the concatenated heads. The full model interleaves multi-head GLA layers with feed-forward networks.

The paper also describes a hardware-efficient training algorithm for linear attention, FLASHLINEARATTENTION, which it reports is faster than FLASHATTENTION-2 as a standalone layer. In its language modeling experiments, the paper reports that a GLA Transformer trained on 2K-token sequences generalizes to sequences longer than 20K without significant perplexity degradation.

Key idea. The paper adds data-dependent gates to linear attention and gives a hardware-efficient chunkwise algorithm for training the resulting GLA Transformer.

  • GLA
  • GLA Transformer
  • Gated Linear Attention
  • linear attention
  • FlashLinearAttention
  • flash-linear-attention
  • language model
  • linear-time inference
  • length generalization

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

Cite the paper

@misc{yang2024gatedlinearattentiontransformers,
      title={Gated Linear Attention Transformers with Hardware-Efficient Training}, 
      author={Songlin Yang and Bailin Wang and Yikang Shen and Rameswar Panda and Yoon Kim},
      year={2024},
      eprint={2312.06635},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2312.06635}, 
}