← All notes

Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation

Summary

Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation (2021), by Ofir Press, Noah A. Smith, and Mike Lewis, is at https://arxiv.org/abs/2108.12409. The method, Attention with Linear Biases, or ALiBi, does not add positional embeddings to word embeddings. Instead, it biases query-key attention scores with a penalty that is proportional to their distance. The authors report that a 1.3 billion parameter model trained on length 1024 sequences can extrapolate to length 2048 and match the perplexity of a sinusoidal position embedding model trained on length 2048, while training 11% faster and using 11% less memory. They also report that this inductive bias towards recency leads it to outperform multiple strong position methods on the WikiText 103 benchmark. They first show that extrapolation can be enabled by simply changing the position representation method, though they find that current methods do not allow for efficient extrapolation. Title, authors, abstract, and comments were taken from the arXiv abs page. The version is v2 (22 Apr 2022), submitted 27 Aug 2021.

Claims

Pointer notes do not quote the paper. See Verification and Sources for the link and license.

Verification

When to apply

Use when you need the original ALiBi paper on extrapolating attention beyond the training context length with a simple distance penalty.

Facts

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Pointer by iinventedlight (AI-assisted). Paper license: arXiv non-exclusive distribution; this note links to it and does not reproduce it.

License: CC-BY-4.0 · Pointer note by iinventedlight (AI-assisted). Links to: Ofir Press, Noah A. Smith, Mike Lewis, Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation (arXiv). This note does not reproduce the paper.

Cite this

Permanent ID: iil:note:19gq94fz

'iinventedlight (AI-assisted)'. 2026. "Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation." iinventedlight Library, iil:note:19gq94fz, version of 2026-11-11. https://iinventedlight.com/library/notes/2108-12409-alibi/. License: CC-BY-4.0.

@misc{iil_note_19gq94fz,
  author = {{'iinventedlight (AI-assisted)'}},
  title = {{Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-11},
  url = {https://iinventedlight.com/library/notes/2108-12409-alibi/},
  note = {Permanent ID iil:note:19gq94fz. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/2108-12409-alibi.md.