{"url":"/method/alibi","slug":"alibi","name":"ALiBi","full_name":"Attention with Linear Biases","full_name_withheld":false,"description_markdown":"**ALiBi**, or **Attention with Linear Biases**, is a [positioning method](https://paperswithcode.com/methods/category/position-embeddings) that allows [Transformer](https://paperswithcode.com/methods/category/transformers) language models to consume, at inference time, sequences which are longer than the ones they were trained on. \r\n\r\nALiBi does this without using actual position embeddings. Instead, computing the attention between a certain key and query, ALiBi penalizes the attention value that that query can assign to the key depending on how far away the key and query are. So when a key and query are close by, the penalty is very low, and when they are far away, the penalty is very high. \r\n\r\nThis method was motivated by the simple reasoning that words that are close-by matter much more than ones that are  far away.\r\n\r\nThis method is as fast as the sinusoidal or absolute embedding methods (the fastest positioning methods there are). It outperforms those methods and Rotary embeddings when evaluating sequences that are longer than the ones the model was trained on (this is known as extrapolation).","description_state":"present","introduced_year":null,"introduced_by":{"title":"Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation","paper":"/paper/train-short-test-long-attention-with-linear","first_author":"Ofir Press","n_authors":3,"url_abs":null,"archive_paper_url":"https://paperswithcode.com/paper/train-short-test-long-attention-with-linear"},"source":{"url":"https://arxiv.org/abs/2108.12409v2","title":"Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation","url_on_a_paper_host":true},"code_snippet_url":null,"code_snippet_url_on_a_code_host":false,"categories":[{"area":"General","area_id":"general","collection":"Position Embeddings","url":"/methods/category/position-embeddings","pwc_aliases":[]},{"area":"Natural Language Processing","area_id":"natural-language-processing","collection":"Inference Extrapolation","url":"/methods/category/inference-extrapolation","pwc_aliases":[]}],"n_papers_tagged":19,"archive_num_papers":19,"papers_newest_first":[{"paper":null,"title":"A standard transformer and attention with linear biases for molecular conformer generation","date":"2025-06-24","arxiv_id":"2506.19834","n_code_links":0,"syntology":null},{"paper":"/paper/seqpe-transformer-with-sequential-position","title":"SeqPE: Transformer with Sequential Position Encoding","date":"2025-06-16","arxiv_id":"2506.13277","n_code_links":1,"syntology":{"ran":4,"of":12,"unverified":8,"pointer_only":12}},{"paper":"/paper/context-aware-biases-for-length-extrapolation","title":"Context-aware Biases for Length Extrapolation","date":"2025-03-11","arxiv_id":"2503.08067","n_code_links":1,"syntology":{"ran":1,"of":1,"unverified":0,"pointer_only":1}},{"paper":null,"title":"zScore: A Universal Decentralised Reputation System for the Blockchain Economy","date":"2025-02-17","arxiv_id":"2503.05718","n_code_links":0,"syntology":null},{"paper":null,"title":"Linear Recency Bias During Training Improves Transformers' Fit to Reading Times","date":"2024-09-17","arxiv_id":"2409.11250","n_code_links":0,"syntology":null},{"paper":null,"title":"Towards Inducing Document-Level Abilities in Standard Multilingual Neural Machine Translation Models","date":"2024-08-21","arxiv_id":"2408.11382","n_code_links":0,"syntology":null},{"paper":"/paper/mitigate-position-bias-in-large-language","title":"Mitigate Position Bias in Large Language Models via Scaling a Single Dimension","date":"2024-06-04","arxiv_id":"2406.02536","n_code_links":1,"syntology":{"ran":16,"of":22,"unverified":6,"pointer_only":0}},{"paper":null,"title":"Can Perplexity Reflect Large Language Model's Ability in Long Text Understanding?","date":"2024-05-09","arxiv_id":"2405.06105","n_code_links":0,"syntology":null},{"paper":null,"title":"MEP: Multiple Kernel Learning Enhancing Relative Positional Encoding Length Extrapolation","date":"2024-03-26","arxiv_id":"2403.17698","n_code_links":0,"syntology":null},{"paper":"/paper/audiobox-unified-audio-generation-with","title":"Audiobox: Unified Audio Generation with Natural Language Prompts","date":"2023-12-25","arxiv_id":"2312.15821","n_code_links":0,"syntology":null},{"paper":"/paper/scoreperformer-expressive-piano-performance","title":"ScorePerformer: Expressive Piano Performance Rendering With Fine-Grained Control","date":"2023-11-04","arxiv_id":null,"n_code_links":1,"syntology":null},{"paper":null,"title":"HyPE: Attention with Hyperbolic Biases for Relative Positional Encoding","date":"2023-10-30","arxiv_id":"2310.19676","n_code_links":0,"syntology":null},{"paper":"/paper/btlm-3b-8k-7b-parameter-performance-in-a-3b","title":"BTLM-3B-8K: 7B Parameter Performance in a 3B Parameter Model","date":"2023-09-20","arxiv_id":"2309.11568","n_code_links":1,"syntology":{"ran":6,"of":8,"unverified":2,"pointer_only":0}},{"paper":"/paper/slimpajama-dc-understanding-data-combinations","title":"SlimPajama-DC: Understanding Data Combinations for LLM Training","date":"2023-09-19","arxiv_id":"2309.10818","n_code_links":1,"syntology":null},{"paper":"/paper/voicebox-text-guided-multilingual-universal","title":"Voicebox: Text-Guided Multilingual Universal Speech Generation at Scale","date":"2023-06-23","arxiv_id":"2306.15687","n_code_links":1,"syntology":{"ran":8,"of":10,"unverified":2,"pointer_only":0}},{"paper":"/paper/the-impact-of-positional-encoding-on-length-1","title":"The Impact of Positional Encoding on Length Generalization in Transformers","date":"2023-05-31","arxiv_id":"2305.19466","n_code_links":2,"syntology":{"ran":0,"of":7,"unverified":7,"pointer_only":0}},{"paper":"/paper/a-vector-quantized-approach-for-text-to","title":"A Vector Quantized Approach for Text to Speech Synthesis on Real-World Spontaneous Speech","date":"2023-02-08","arxiv_id":"2302.04215","n_code_links":1,"syntology":{"ran":2,"of":2,"unverified":0,"pointer_only":0}},{"paper":null,"title":"Dissecting Transformer Length Extrapolation via the Lens of Receptive Field Analysis","date":"2022-12-20","arxiv_id":"2212.10356","n_code_links":0,"syntology":null},{"paper":"/paper/train-short-test-long-attention-with-linear","title":"Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation","date":"2021-08-27","arxiv_id":"2108.12409","n_code_links":10,"syntology":{"ran":13,"of":16,"unverified":3,"pointer_only":5}}],"papers_shown":19,"tasks":[{"task":null,"name":"Position","papers":5},{"task":"/task/decoder","name":"Decoder","papers":4},{"task":"/task/language-modeling","name":"Language Modeling","papers":4},{"task":"/task/language-modelling","name":"Language Modelling","papers":4},{"task":"/task/sentence","name":"Sentence","papers":2},{"task":"/task/speech-synthesis","name":"Speech Synthesis","papers":2},{"task":"/task/text-to-speech","name":"Text to Speech","papers":2},{"task":"/task/text-to-speech-synthesis","name":"Text-To-Speech Synthesis","papers":2},{"task":"/task/text-to-speech-1","name":"text-to-speech","papers":2},{"task":null,"name":"8k","papers":1},{"task":"/task/audio-generation","name":"Audio Generation","papers":1},{"task":null,"name":"AudioCaps","papers":1},{"task":"/task/code-generation","name":"Code Generation","papers":1},{"task":"/task/diversity","name":"Diversity","papers":1},{"task":"/task/drug-discovery","name":"Drug Discovery","papers":1},{"task":"/task/fad","name":"FAD","papers":1},{"task":"/task/image-classification","name":"Image Classification","papers":1},{"task":"/task/in-context-learning","name":"In-Context Learning","papers":1},{"task":"/task/inductive-bias","name":"Inductive Bias","papers":1},{"task":"/task/knowledge-distillation","name":"Knowledge Distillation","papers":1}],"tasks_shown":20,"n_tasks":29,"usage_by_year":[{"year":"2021","papers":1},{"year":"2022","papers":1},{"year":"2023","papers":8},{"year":"2024","papers":5},{"year":"2025","papers":4}],"row_source":"methods_table","archive":{"source":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","archive_url":"https://paperswithcode.com/method/alibi"},"syntology_read_at":"2026-09-24T18:15:14+00:00"}