HackerPapers

arXiv:2212.10947cs.CL

Parallel Context Windows for Large Language Models

Nir Ratner, Yoav Levine, Yonatan Belinkov, Ori Ram, Inbal Magar, Omri Abend, Ehud Karpas, Amnon Shashua, Kevin Leyton-Brown, Yoav Shoham

Abstract

When applied to processing long text, Large Language Models (LLMs) are limited by their context window. Existing efforts to address this limitation involve training specialized architectures, and cannot be easily applied to off-the-shelf LLMs. We present Parallel Context Windows (PCW), a method that alleviates the context window restriction for any off-the-shelf LLM without further training. The key to the approach is to carve a long context into chunks (``windows''), restrict the attention mechanism to apply only within each window, and re-use the positional embeddings across the windows. Our main results test the PCW approach on in-context learning with models that range in size between 750 million and 178 billion parameters, and show substantial improvements for tasks with diverse input and output spaces. We show additional benefits in other settings where long context windows may be beneficial: multi-hop questions and retrieval-augmented question answering with multiple retrieved documents. Our results highlight Parallel Context Windows as a promising method for applying off-the-shelf LLMs in a range of settings that require long text sequences. We make our code publicly available at https://github.com/ai21labs/parallel-context-windows.

arXiv comments
The 61st Annual Meeting of the Association for Computational Linguistics (ACL 2023)
Journal reference
DOI
Subjects
cs.CLComputation and Language

On Hacker News

Linked by 2 identifiable commenters in 2 comments across 2 threads, from Jun 2025 to Oct 2025.

Comments linking this paper, per year.

Discussed in comments2 threads

    • The observation about the "block-diagonal patterns" in RAG isn't new and has been exploited / explored before: - https://arxiv.org/abs/2410.07590 (literally titled "Block-Attention for Efficient RAG") - https://arxiv.org/abs/2409.15355v3 - https://arxiv.org/abs/2212.10947 The…

      PalmikView on HNParent context

  1. MCP in LM Studio 1 comment
    • Dropping in late into this discussion, but is there any way to "comfortably" use multiple precomputed kv-caches with current models, in the style of this work: https://arxiv.org/abs/2212.10947 ? Meaning, I pre-parse multiple documents, and the prompt and completion attention…

      112233View on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.