fla_layer_rebasedlinearattention
ReBased is a linear attention layer with a learnable quadratic kernel, a revision of the Based model.
Language · 398 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.
At a glance
- Task
- Language
- Parameters
- 97.2K
- Operations
- 398
- Framework
- PyTorch
- Recurrent
- No
- Published
- ACL 2024
- Cited by
- 0 (as of 23 October 2026)
- Authors
- Yaroslav Aksenov, Nikita Balagansky, Sofia Maria Lo Cicero Vaina and others
- Source
- flash-linear-attention 0.5.2
- License
- Apache-2.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
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.
Details
- Stable ID
- m4955
- Graph hash
- 8dbb1cdccde129e96aa8b541c97477ec28a9e6f19c95d2c8feea4850c8d852c8
- Skeleton hash
- b42f4b3a9501915f10010df7d8907a1dd054bb96aca7e0e9109e661692153bc4
- Architecture hash
- 7a908eb89da02c40368d7ff9257afe4369455cf7522c4b0f4a9bb599ac8acfaf
- Diagram SHA-256
- 175e56a2ff3055f0e6d42a0f96d29246dc41e47370ffe3dca1ea15b998984097
- 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.fla_reimpl:build_fla: build({}) What it is
ReBased (Revisited Based) is a variation of the Linear Transformer model that changes how attention kernels are used. A Linear Transformer replaces the direct query-key similarity of attention with a kernel function, which makes the cost of attention linear in the sequence length. ReBased revisits Based, an earlier model that combined a Linear Transformer with a kernel inspired by the Taylor expansion of exponential functions and with convolutional networks.
The paper observes that the Based kernel has a minimal value fixed at 0.5, which makes it difficult to assign a near-zero attention score to specific token pairs. ReBased learns the scale and shift of the quadratic kernel together with the model, so the similarity can be driven to zero. It also applies Layer Normalization to queries and keys before the kernel function.
The paper tests the model on the Multi-Query Associative Recall (MQAR) task at sequence lengths from 128 to 2048. On MQAR it reports that ReBased outperforms all baselines except Attention across sequence lengths and model sizes. After training on the Pile dataset, the paper reports that ReBased performs better than Based at In-Context Learning.
Key idea. The paper replaced the Based kernel with a quadratic kernel whose scale and shift are learned, letting a linear transformer assign zero similarity to specific token pairs.
- rebased
- revisited based
- rebased linear attention
- linear transformer
- linear attention
- learnable kernel function
- in-context learning
- multi-query associative recall
- mqar
- flash linear attention
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{aksenov2024lineartransformerslearnablekernel,
title={Linear Transformers with Learnable Kernel Functions are Better In-Context Models},
author={Yaroslav Aksenov and Nikita Balagansky and Sofia Maria Lo Cicero Vaina and Boris Shaposhnikov and Alexey Gorbatovski and Daniil Gavrilov},
year={2024},
eprint={2402.10644},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2402.10644},
}