{"id":"arxiv:2309.00071","kind":"preprint","title":"YaRN: Efficient Context Window Extension of Large Language Models","authors":["Bowen Peng","Jeffrey Quesnelle","Honglu Fan","Enrico Shippole"],"author_count":4,"year":2023,"published":"2023-08-31","venue":null,"cited_by":null,"doi":null,"arxiv_id":"2309.00071","nct_id":null,"source_url":"https://arxiv.org/abs/2309.00071","archive_url":"https://space-kitty.com/papers/arxiv:2309.00071","updated":"2026-02-06","pmid":null,"pmcid":null,"openalex_id":null,"pdf_url":"https://arxiv.org/pdf/2309.00071","abstract":"Rotary Position Embeddings (RoPE) have been shown to effectively encode positional information in transformer-based language models. However, these models fail to generalize past the sequence length they were trained on. We present YaRN (Yet another RoPE extensioN method), a compute-efficient method to extend the context window of such models, requiring 10x less tokens and 2.5x less training steps than previous methods. Using YaRN, we show that LLaMA models can effectively utilize and extrapolate to context lengths much longer than their original pre-training would allow, while also surpassing previous the state-of-the-art at context window extension. In addition, we demonstrate that YaRN exhibits the capability to extrapolate beyond the limited context of a fine-tuning dataset. Code is available at https://github.com/jquesnelle/yarn","abstract_license":"CC0-1.0 (arXiv descriptive metadata)","license":null,"is_open_access":false,"retracted":false,"peer_reviewed":false,"categories":["cs.CL","cs.AI","cs.LG"],"details":null,"provenance":"arxiv","attribution":"Abstract: arXiv descriptive metadata (CC0). Thank you to arXiv for use of its open access interoperability. This service was not reviewed or approved by, nor does it necessarily express or reflect the policies or opinions of, arXiv.","topics":[{"slug":"llm-architectures","name":"LLM Architectures & Pretraining","domain_slug":"ai"}],"cited_in_dossiers":[{"slug":"llm-architectures","title":"LLM Architectures & Pretraining: State of the Field (October 2026)","url":"https://space-kitty.com/dossiers/llm-architectures"}]}