
fla_gla
Language242 ops68.7K params
Gated linear attention: linear attention with data-dependent gates, usable in place of standard attention.
Language · 242 operations Checked
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.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
This model is the GLA Transformer backbone as built by the flash-linear-attention library, with GLA layers interleaved with feed-forward networks and no language-model head.
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.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@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},
}