Papers › YaRN: Efficient Context Window Extension of Large Language Models

YaRN: Efficient Context Window Extension of Large Language Models

31 Aug 2023arXiv:2309.00071archive 2025-07-28

Bowen Peng, Jeffrey Quesnelle, Honglu Fan, Enrico Shippole

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. The models fine-tuned using YaRN has been made available and reproduced online up to 128k context length at https://github.com/jquesnelle/yarn

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2309.00071")

Code

Syntology Ran 4 of 20 code samples harvested from 1 repository linked to this paper; 16 have no recorded run. Of those that ran: 1 ran · violated contract; 3 ran with no contract checked.

By repository: community (archive-listed): 20 samples from 1 repository, 4 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

jquesnelle/scaled-rope officialmentioned in papermentioned on GitHubpytorchMIT report
jquesnelle/yarn officialmentioned in papermentioned on GitHubpytorchMIT report
nvidia/ruler mentioned on GitHubpytorch report
qwenlm/qwen2-vl mentioned on GitHubpytorchApache-2.0 report
qwenlm/qwen2.5-coder mentioned on GitHub report
qwenlm/qwen2.5-vl mentioned on GitHubpytorchApache-2.0 report
qwenlm/qwq mentioned on GitHubApache-2.0 report
tigerresearch/tigerbot mentioned on GitHubpytorchApache-2.0 report
tongyi-zhiwen/qwenlong-l1 mentioned on GitHubpytorch report
ymcui/chinese-llama-alpaca-2 mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

20 samples harvested; 4 ran; 0 honoured the contract we drafted; 16 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
3ran
16unverified

Licence: 0 of the 20 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from qwenlm/qwq. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

conflict_make qwenlm/qwq/eval/eval/ifeval_utils/instructions_registry.py community (archive-listed) ran Apache-2.0 (permissive) · d197da35ee544f75 · report
count_words qwenlm/qwq/eval/eval/ifeval_utils/instructions_util.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · cdcc85ca09b00f7e · report
is_multi_choice qwenlm/qwq/eval/eval/math_opensource.py community (archive-listed) ran · violated contract Apache-2.0 (permissive) · d338a8cb44aeb6b4 · report
split_into_sentences qwenlm/qwq/eval/eval/ifeval_utils/instructions_util.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · 34d346853108011e · report
clean_if_name qwenlm/qwq/eval/eval/livecodebench_v5_utils/testing_util.py community (archive-listed) unverified Apache-2.0 (permissive) · 5faad4dd18dd77ef · report
compute_metrics_from_results qwenlm/qwq/eval/eval/livecodebench_v5_utils/pass_k_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 9188e3d845f5322a · report
count_completed_samples qwenlm/qwq/eval/generate_api_answers/infer_multithread.py community (archive-listed) unverified Apache-2.0 (permissive) · 09565dfe50b43516 · report
count_sentences qwenlm/qwq/eval/eval/ifeval_utils/instructions_util.py community (archive-listed) unverified Apache-2.0 (permissive) · f79646ddd0a03162 · report
estimate_pass_at_k qwenlm/qwq/eval/eval/livecodebench_v5_utils/pass_k_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 9df10eb02582b09f · report
extract_instance_results qwenlm/qwq/eval/eval/livecodebench_v5_utils/pass_k_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 406597cd2faf5fef · report
get_content qwenlm/qwq/eval/generate_api_answers/utils_vllm.py community (archive-listed) unverified Apache-2.0 (permissive) · 7b5542cec0c01464 · report
get_qwen_question_template_answer qwenlm/qwq/eval/eval/livecodebench_v5_utils/process_data.py community (archive-listed) unverified Apache-2.0 (permissive) · 292970496395b6c3 · report
get_qwen_reasoning_question_template_answer qwenlm/qwq/eval/eval/livecodebench_v5_utils/process_data.py community (archive-listed) unverified Apache-2.0 (permissive) · 2e92414197a95a18 · report
load_code_generation_dataset qwenlm/qwq/eval/eval/livecodebench_v5_utils/process_data.py community (archive-listed) unverified Apache-2.0 (permissive) · aa6fde3b731edf5c · report
make_function qwenlm/qwq/eval/eval/livecodebench_v5_utils/testing_util.py community (archive-listed) unverified Apache-2.0 (permissive) · e478b5bb18723734 · report
preprocess qwenlm/qwq/eval/eval/livecodebench_v5.py community (archive-listed) unverified Apache-2.0 (permissive) · 5ada7674f9cc64ee · report
removeprefix qwenlm/qwq/eval/eval/ifeval_utils/instructions.py community (archive-listed) unverified Apache-2.0 (permissive) · 1f2c82cb51d70854 · report
removesuffix qwenlm/qwq/eval/eval/ifeval_utils/instructions.py community (archive-listed) unverified Apache-2.0 (permissive) · c18b33dc2c9d3ac3 · report
truncatefn qwenlm/qwq/eval/eval/livecodebench_v5_utils/testing_util.py community (archive-listed) unverified Apache-2.0 (permissive) · f23d0f0bf67cc7cb · report
work qwenlm/qwq/eval/eval/math_opensource.py community (archive-listed) unverified Apache-2.0 (permissive) · 97dd1cf2a21b437c · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

fail

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections