Periscope:将冻结语言模型扩展到其上下文窗口之外

·

研究论文 · 2026/10/06

语言模型在一次二次前向传播中读取长文本,在上下文窗口处停止,并在达到窗口前就随长度增加而损失准确率。我们研究当在有限集合上做决策时,读取是否可以分解:哪篇文档相关、哪个选项被支持、哪段文字是证据。Periscope 是一种免训练推理方法,它将文本的 N 个块排列在 K×K 网格上,K=ceil(N),并向冻结模型询问关于 K 个连续块的局部跨度以及 K 个采样整个文本的跨步跨度的相同问题,在一个 token 上读取每个答案的对数几率。每个答案取最佳局部和跨步得分,通过两个跨度对每个块评分免费给出证据图,其峰值是答案背后的块。对于 s 个 token 的文本和块大小 c,每次探测约 sc 个 token,因此 W 个 token 的窗口以 s^1.5 的成本达到 W^2/c 个 token。该图取代了长读取。在 LongBench v2 上,仅读取图中排名最高的 K 个块(9k token),即可匹配同一模型在 32k 到 1M token 窗口中的最佳窗口读取;在 InfiniteBench 上(中位上下文 150k token),它领先最佳窗口读取 5 分。同一张图在 BRIGHT 的长文档语料库上以六种方法中最佳的 NDCG@10 进行排序。每次调用仅缓存一个探测,因此 27B 模型可在单个 80GB GPU 上读取 4.5M token 上下文,而单次传播需要 296GB 缓存。长读取需要的 GPU 是能容纳模型的,而非容纳文本的。

该方法无需训练即可扩展冻结语言模型的上下文窗口,显著降低长文本推理的显存需求,并在多个长文本基准上达到或超越传统窗口读取的性能,为长上下文处理提供了高效实用的新思路。

A language model reads long text in one quadratic forward pass, stops at the context window, and loses accuracy with length before reaching it. We ask whether the read can be factorized when deciding over a finite set: which document is relevant, which option is supported, which passage is the evidence. Periscope, a training-free inference method, arranges the N chunks of a text on a K{times}K grid with K{=}lceilNrceil and asks a frozen model the same question about K local spans of consecutive chunks and K strided spans that sample the whole text, reading the log-odds of every answer at one token. Each answer takes its best local and strided score, and scoring every chunk by its two spans gives an evidence map at no further cost, whose peak is the chunk behind the answer. Every probe is about sc tokens for a text of s tokens and chunk size c, so a window of W tokens reaches W^{2}/c tokens at s^{1.5} cost. The map replaces the long read. On LongBench v2, reading only the K chunks the map ranks highest, 9k tokens, matches the same model's best window read across windows from 32k to 1M tokens, and on InfiniteBench, where the median context is 150k tokens, it leads the best window read by 5 points. The same map ranks BRIGHT's long-document corpora with the best NDCG@10 of six methods. Each call caches only one probe, so a 27B model reads 4.5M-token contexts on one 80GB GPU, where a single pass would need 296GB of cache. A long read then needs a GPU that holds the model, not one that holds the text.

阅读原文

参与讨论