Overcoming the Context Window Bottleneck in In-Context Learning

475 concepts376 papers3 proposals

In-context learning (ICL) allows large language models (LLMs) to adapt to new tasks without updating their underlying weights. By simply appending a few demonstrations to the input prompt, the model infers the underlying pattern and generates the correct response.

However, this paradigm operates under a strict physical constraint: the context window bottleneck. Unlike traditional supervised fine-tuning, where a model can iteratively learn from thousands or millions of examples across an entire dataset, an in-context learner must ingest its entire "training set" within a single forward pass. As tasks grow in complexity, data volume, or structural scale, this fixed token budget becomes a critical ceiling on model performance.

The Token Economy of In-Context Learning

To understand why the context window is a bottleneck, we must look at how data scales versus how transformers process tokens. In a standard supervised setting, adding more data is almost always beneficial. In ICL, however, adding more data means adding more tokens to the prompt.

As Hyunsoo Cho et al. demonstrate in Prompt-Augmented Linear Probing: Scaling beyond the Limit of Few-Shot In-Context Learners, this creates a hard ceiling on accuracy. You cannot simply feed an entire training dataset into a prompt. In their work on $k$NN prompting, Benfeng Xu et al. emphasize in $k$NN Prompting: Beyond-Context Learning with Calibration-Free Nearest Neighbor Inference that this fixed token limit prevents models from scaling effectively on data-rich tasks that naturally benefit from extensive training data.

Even as modern architectures expand context windows to hundreds of thousands or millions of tokens, simple scaling hits diminishing returns and operational walls. Rishabh Agarwal et al. show in Many-Shot In-Context Learning that while "many-shot" ICL (using hundreds or thousands of examples) yields massive performance gains, it introduces severe computational overhead. In sequential or physical domains like robotics, Edward Johns et al. note in Keypoint Action Tokens Enable In-Context Imitation Learning in Robotics that packing more demonstrations into the prompt scales computational costs quadratically and increases latency, leading to a practical performance plateau.

Furthermore, Eric Elmoznino et al. argue in In-Context Learning and Occam's Razor that ICL operates under a fixed computational budget per forward pass. If the prompt's complexity outstrips the model's single-pass capacity, the model will underfit, failing to capture intricate patterns despite the presence of the data.

Maximizing Informational Density via Strategic Selection

Because the context window cannot be expanded infinitely without cost, a major branch of research treats the prompt as a highly selective cache. If you can only fit five examples, those five examples must be mathematically optimal for the given query.

[Massive Dataset / External Knowledge] 
                 │
                 ▼  (Information-Theoretic / Similarity Retrieval)
┌────────────────────────────────────────┐
│  Optimized Context Window (Cache)      │
│  ┌──────────────────────────────────┐  │
│  │ Diverse & Relevant Exemplars     │  │
│  └──────────────────────────────────┘  │
└────────────────────────────────────────┘
                 │
                 ▼
     [Single Forward Pass Inference]

To achieve this, researchers design intelligent retrieval mechanisms that maximize informational density. For example, Soumya Suvra Ghosal et al. developed KITE in KITE: Kernelized and Information Theoretic Exemplars for In-Context Learning, which uses information theory and kernel methods to select examples that are simultaneously relevant to the user query and diverse enough to help the model generalize.

This selective approach is especially critical in structured or non-textual domains. In tabular data prediction, David Rundel et al. demonstrate in Interpretable Machine Learning for TabPFN that random pruning of datasets to fit context limits severely degrades predictive performance. Similarly, when dealing with structural data like graphs, Zhengyu Hu et al. explain in Let's Ask GNN: Empowering Large Language Model for Graph In-Context Learning that retrieval strategies must be explicitly redesigned to select compact yet structurally diverse subgraphs that do not saturate the model's reasoning capacity.

The Bottleneck Beyond Data: Tools and Action Spaces

The context window bottleneck does not just restrict training examples; it also limits the action spaces of agentic systems. When an LLM is used to call external APIs or interact with large databases, the documentation or schemas for those systems must typically reside in the prompt.

As the ecosystem of external tools grows, this becomes impossible. Qiancheng Xu et al. point out in Enhancing Tool Retrieval with Iterative Feedback from Large Language Models that finite context windows prevent models from directly processing thousands of available APIs within a single prompt. Wenxiu Sun et al. confirm this barrier in MCPVerse: An Expansive, Real-World Benchmark for Agentic Tool Use, noting that hard-coded constraints on tool-mounting force a reliance on lossy retrieval mechanisms.

To bypass this entirely, Renxi Wang et al. propose a paradigm shift in ToolGen: Unified Tool Retrieval and Calling via Generation. Instead of stuffing tool descriptions into the context window, they expand the model's vocabulary, treating external APIs as unique tokens. This allows the model to trigger tools generatively, completely bypassing the prompt length constraint.

A similar bottleneck occurs in large-vocabulary classification. When a model must choose from thousands of potential labels, listing them all in-context is unfeasible. Pan Zhang et al. address this in RAR: Retrieving And Ranking Augmented MLLMs for Visual Recognition by using a two-stage retrieve-and-rank framework, reducing the search space externally before letting the multimodal model perform fine-grained reasoning on a manageable subset.

Architectural and Hybrid Workarounds

When clever prompting and retrieval are still insufficient to overcome the token ceiling, researchers alter the underlying architecture or combine ICL with parametric learning.

One approach is to use the language model as a feature extractor rather than a final decision-maker. The framework proposed by Hyunsoo Cho et al. in Prompt-Augmented Linear Probing: Scaling beyond the Limit of Few-Shot In-Context Learners wraps inputs in natural language templates and prepends representative examples, but then trains a linear layer on top of the extracted representations. This hybrid approach retains the task-awareness of ICL but allows the system to scale seamlessly as more training data becomes available, breaking the hard ceiling of the context window.

For tabular data, where context limitations are particularly punishing, Yuxin Wang et al. introduce BoostPFN in Prior-Fitted Networks Scale to Larger Datasets When Treated as Weak Learners. Instead of trying to force a massive dataset into a single context window, they treat a fixed-window Prior-Fitted Network (PFN) as a weak learner within a gradient boosting ensemble.

[Massive Tabular Dataset]
           │
           ├─► Subsample 1 ─► [ Fixed-Window PFN ] ─┐
           ├─► Subsample 2 ─► [ Fixed-Window PFN ] ─┼─► [Gradient Boosting Ensemble]
           │                                        │
           └─► Subsample N ─► [ Fixed-Window PFN ] ─┘

By optimizing input sampling weights across multiple sequential forward passes rather than expanding a single prompt, BoostPFN scales to datasets 50 times larger than the model's native pre-trained capacity, demonstrating how architectural orchestration can effectively dissolve the context window bottleneck.

History & citationVersion 2 · 2026-10-04

Current · Permanent link

  1. Version 2 (latest) · 2026-10-04 · 359 papers
  2. Version 1 · 2026-10-04 · 294 papers
Cite this direction

Latest version (a living page):

@misc{lacuna_context_window_bottleneck_5d9d0abc,
  title = {context window bottleneck},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/context-window-bottleneck/rdr_5d9d0abc684741bdab7ba31edda76c27},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-25},
}

This exact version (version 2, frozen text):

@misc{lacuna_context_window_bottleneck_5d9d0abc_v2,
  title = {context window bottleneck},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/context-window-bottleneck/rdr_5d9d0abc684741bdab7ba31edda76c27/v/2},
  note = {Version 2, frozen 2026-10-04. Accessed 2026-11-25},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake