QueryStop: Dynamic Stop Signals for Efficient Streaming Inference

Michelle Shu, Jingyao Li, Pengguang Chen, Shu Liu, Jiaya Jia, Ramin ZabihNeurIPS 2026

TL;DR

When you search for a fact in a massive document, you stop reading the moment you find it. Large language models, however, routinely consume entire streams of incoming text even after they have everything they need. QueryStop taps into a handful of specialized, query-aligned attention heads inside the LLM to shout "Stop!" at the exact moment sufficient evidence arrives—cutting down compute and latency while actually improving answer accuracy.

What Problem Does This Paper Address?

Modern LLM agents don't just read static prompts; they browse the web, query databases, and ingest streaming context block by block. Because nobody knows in advance how much reading a specific question requires, engineers face a Goldilocks dilemma: cut the stream off too early, and the model misses the answer; let it read too much, and you burn GPU cycles while drowning the model in distracting noise.

Most context-efficiency tricks (like prompt compression or token pruning) assume you already have the full text sitting in front of you. You could repeatedly prompt the LLM to ask, "Do you have enough info yet?", but generating those self-assessments adds heavy latency and often breaks the KV cache (forcing redundant re-reads). Recent work showed you can instead attach lightweight linear classifiers ("probes") to the LLM's internal states to detect sufficiency without generating extra text. However, prior probing methods averaged features globally across the whole context, washing out localized, needle-in-a-haystack clues.

Methods

Inspired by information foraging theory—the idea that animals and humans follow an "information scent" toward their goal—the authors introduce QueryStop. Instead of taking a blurry global average of what the model has read, QueryStop builds an ensemble of specialized query-focused attention heads.

Figure 2: Overview of the QueryStop pipeline. As a long stream of context is processed, we evaluate block-level checkpoints. At each checkpoint, we apply linear probing to an ensemble of specialized attention heads to extract query-focused feature representations. These representations are then used to train a binary classifier, and the top-performing model is selected to trigger the dynamic context stop signal. Note that concatenation with a global representation is an optional supplement.

Here is how it works in practice:

  1. Streaming Checkpoints: Incoming text arrives in non-overlapping blocks (e.g., 10% chunks), allowing seamless KV-cache reuse.
  2. Following the Scent (What's New): Before reading the stream, QueryStop averages the input query's vectors ($\bar{Q}$) once and caches it. As each context block is processed during the normal forward pass, it computes the dot-product interaction between $\bar{Q}$ and the context's key vectors ($K_t$). Passing these scores through a softmax creates a dynamic filter that magnifies hidden states of tokens aligning with the user's intent.
  3. Lightweight Ensemble (What's Standard + Tailored): Using validation data, the system identifies the top 5 most predictive attention heads and trains an ensemble of 4 lightweight binary classifiers on their concatenated features. At inference, if the classifier's sufficiency score crosses a threshold $\tau$, context intake halts immediately and the model generates its final answer. (An optional variant, QueryStop-C, concatenates global pooled features alongside query-focused ones).

Datasets

No new datasets are introduced, though the authors propose a new metric called Sufficiency Reach Rate (SRR)—the percentage of times a stop signal waits at least until the ground-truth evidence has been read. They evaluate across four existing benchmark groups spanning 11 datasets:

  • Long: Combines single-hop QA (SQuAD, Natural Questions, PCSD code understanding) and multi-hop reasoning (HotpotQA, MuSiQue, Multi-hop Key-Value Retrieval).
  • Needle-in-a-Haystack: Isolates tiny target facts buried in up to 32K tokens of distractors.
  • 2WikiMultiHopQA: Web-style multi-hop reasoning over Wikipedia and Wikidata.
  • Passage Retrieval (PolEval 2022/23): Practical, messy retrieval across trivia, e-commerce FAQs, and Polish legal texts.

Key Insights and Ideas

  • Sufficiency lives in mid-layer "query heads": Probing individual attention heads reveals that global averaging yields lukewarm signals, whereas query-weighted features light up brightly in a concentrated cluster of middle-layer heads.
Heatmaps of validation F1 scores across layers and heads on Qwen 3.5 9B, showing strong sufficiency signals concentrated in mid-layer query-focused heads.
  • Global context is mostly dead weight for stopping: When the hybrid QueryStop-C model is given complete freedom to weigh both query-focused and global features, 4.25 of its top 5 chosen heads overlap with the pure query method. Determining sufficiency is fundamentally a query-routing task, not a global summary task.
  • Uncertainty beats confidence: In ablations testing token entropy, weighting high-entropy tokens drastically outperformed weighting low-entropy (high-confidence) tokens—showing that moments of high information gain are what signal that key evidence just arrived.
  • Rock-solid threshold stability: Prior global-probing baselines are notoriously finicky; nudging the confidence threshold slightly can cause accuracy to cliff-dive. QueryStop stays stable across a much wider threshold window, sparing engineers from painful hyperparameter tuning.

Key Results

Tested across Qwen 3.5 (2B, 4B, and 9B), QueryStop consistently beats both self-prompting and the prior state-of-the-art probing baseline (Dynamic Context Cutoff, or DCC):

  • Better Stop Precision: Improves binary stop-signal prediction by 3.52% F1 on average over DCC, and massively outperforms self-prompting.
  • Higher Accuracy at Equal Compression: Under matched token reduction, QueryStop boosts Sufficiency Reach Rate from 87.12% to 94.73% and improves downstream task accuracy by 7.09% on average. On Needle-in-a-Haystack (Qwen 3.5 4B) at ~3.1$\times$ token reduction, DCC stops too early and crashes to 17.5% accuracy, whereas QueryStop achieves 43.3% accuracy (nearly a 2.5$\times$ jump).
  • Real Hardware Gains: Profiling Qwen 3.5 4B end-to-end on the Long benchmark shows QueryStop-Q cuts peak GPU memory by 17.9%, boosts throughput by 20.3%, and trims p95 latency by 8.0% compared to full-context inference.

Limitations and Future Work

  • Supervision vs. Model Knowledge: Probes are trained using human-annotated evidence boundaries as ground truth. However, an LLM might already know an answer from pretraining before seeing the evidence, or fail to deduce the answer even after reading all the clues.
  • Base Model Dependence: The authors note that weaker models (such as Llama 3.2 and Mistral v3 in preliminary tests) had poor full-context accuracy to begin with, making it hard to evaluate utility preservation—so experiments focused on the Qwen 3.5 family, and specifically only its standard self-attention layers (ignoring its linear-attention layers).
  • Future Directions: Not explicitly discussed in the main text (detailed analyses of model exclusions and annotation boundaries are deferred to the appendix).

Summary updated

Abstract

As language models are increasingly deployed in long-context and streaming workflows, deciding when to stop context processing is central to inference efficiency. While recent research has shown that a subset of attention heads encodes sufficiency signals, these markers are typically detected via static, task-agnostic global features. In this paper, we demonstrate that stop signals are inherently query-relevant and introduce QueryStop, an attention-aggregation method that systematically identifies query-focused attention heads whose hidden features effectively align with the input query. Driven primarily by query-focused heads, this tailored ensemble yields high-fidelity representations that significantly improve sufficiency prediction. Across four benchmarks on eleven datasets, our method improves sufficiency stop prediction by 3.52\% F1 on average. Under comparable token reduction, it raises Sufficiency Reach Rate (SRR), our proposed stopping-adequacy metric, from 87.12\% to 94.73\% and yields a 7.09\% average gain in downstream task accuracy over the prior baseline. Collectively, these results show that QueryStop effectively eliminates unnecessary context processing while simultaneously improving downstream answer quality.
BibTeX
@inproceedings{shu2026querystop,
  author = {Michelle Shu and Jingyao Li and Pengguang Chen and Shu Liu and Jiaya Jia and Ramin Zabih},
  title = {{QueryStop: Dynamic Stop Signals for Efficient Streaming Inference}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=bBwetMwgJB},
}
Figure