Papers › Extending Context Window of Large Language Models via Positional Interpolation

Extending Context Window of Large Language Models via Positional Interpolation

27 Jun 2023arXiv:2306.15595archive 2025-07-28

Shouyuan Chen, Sherman Wong, Liangjian Chen, Yuandong Tian

We present Position Interpolation (PI) that extends the context window sizes of RoPE-based pretrained LLMs such as LLaMA models to up to 32768 with minimal fine-tuning (within 1000 steps), while demonstrating strong empirical results on various tasks that require long context, including passkey retrieval, language modeling, and long document summarization from LLaMA 7B to 65B. Meanwhile, the extended model by Position Interpolation preserve quality relatively well on tasks within its original context window. To achieve this goal, Position Interpolation linearly down-scales the input position indices to match the original context window size, rather than extrapolating beyond the trained context length which may lead to catastrophically high attention scores that completely ruin the self-attention mechanism. Our theoretical study shows that the upper bound of interpolation is at least ∼600 × smaller than that of extrapolation, further demonstrating its stability. Models extended via Position Interpolation retain its original architecture and can reuse most pre-existing optimization and infrastructure.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

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="2306.15595")

Code

Syntology Ran 13 of 15 code samples harvested from 5 repositories linked to this paper; 2 have no recorded run. Of those that ran: 2 ran · honoured contract; 4 ran · our draft was wrong; 3 ran · fixture could not drive it; 4 ran with no contract checked.

By repository: community (archive-listed): 13 samples from 5 repositories, 11 ran; 2 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

chrisociepa/allamo mentioned on GitHubpytorchMIT report
hkunlp/chunkllama mentioned on GitHubpytorch report
jzhang38/longmamba mentioned on GitHubpytorch report
lululuyi/longheads mentioned on GitHubpytorch report
pku-yuangroup/open-sora-plan mentioned on GitHubpytorch report
yangjianxin1/longqlora 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

15 samples harvested; 13 ran; 2 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-25; that is when this build read the record, not when the samples ran.

2ran · honoured contract
4ran · our draft was wrong
3ran · fixture could not drive it
4ran
2unverified

Licence: 8 of the 15 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 5 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “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.

apply_rotary_pos_emb_for_relative_keys lululuyi/longheads/modeling_longheads/modeling_llama.py community (archive-listed) ran · fixture could not drive it no licence file found · pointer only · adb0da12fb38486f · report
calculate_md5 chrisociepa/allamo/allamo/train_utils.py community (archive-listed) ran MIT (permissive) · c168ab0101094c68 · report
estimate_mfu chrisociepa/allamo/allamo/train_utils.py community (archive-listed) ran MIT (permissive) · 7cfe5dec1a04ab86 · report
evaluate yangjianxin1/longqlora/script/evaluate/evaluate.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · 24732fd7312ff4a8 · report
format_seconds_as_time chrisociepa/allamo/allamo/train_utils.py community (archive-listed) ran fingerprinted MIT (permissive) · 8fa7d4f410dbb734 · report
generate_prompt ymcui/chinese-llama-alpaca-2/scripts/inference/inference_hf.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · b47f5a611055da10 · report
generate_prompt_landmark lululuyi/longheads/passkey_retrieval/passkey_retrieval.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · 2a07d4a8772a06b1 · report
get_fn_init_data chrisociepa/allamo/allamo/model/lra.py community (archive-listed) ran fingerprinted MIT (permissive) · 94e2c02bdd3fbfa3 · report
get_mscale hkunlp/chunkllama/chunkllama_attn_replace.py community (archive-listed) ran · honoured contract fingerprinted Apache-2.0 (permissive) · f530e017034693d2 · report
iceildiv yangjianxin1/longqlora/script/evaluate/evaluate.py community (archive-listed) ran · honoured contract fingerprinted no licence file found · pointer only · 51ee91de5e3fdcaa · report
is_number_in_range lululuyi/longheads/passkey_retrieval/passkey_retrieval.py community (archive-listed) ran · fixture could not drive it fingerprinted no licence file found · pointer only · 1a574afcd22201fe · report
merge_attn_outputs hkunlp/chunkllama/chunkllama_attn_replace.py community (archive-listed) unverified Apache-2.0 (permissive) · 410511f95749dd69 · report
passkey_retrieval_test lululuyi/longheads/passkey_retrieval/passkey_retrieval.py community (archive-listed) unverified no licence file found · pointer only · 41f1bbe0e5a8eaee · report
apply_rotary_pos_emb identical code first harvested elsewhere ran · fixture could not drive it licence of this copy not recorded · f725bc2d76076485 · report
rotate_half identical code first harvested elsewhere ran · our draft was wrong fingerprinted licence of this copy not recorded · b99eea6376d1e212 · report

Tasks

Document SummarizationLanguage ModelingLanguage ModellingRetrieval

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

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