Skip to content

Mergeable Model-Side Aggregation States for Long-Context Language Models

Jul 2026 · arXiv.org · Vol abs/2607.26448 · 1 citation · 25 references
Computer Science

TL;DR

A model-side aggregation interface is introduced that maintains compact Hash-based HyperLogLog sketch states alongside a frozen language model that improves over direct full-context reasoning over chain-of-thought reasoning.

Abstract

A known limitation of long-context language models is their increasingly unreliable performance in non-additive, set-based aggregation as context length grows. Examples include cardinality estimation, set relationships, and grouped statistics, which widely exist in logs, program outputs, tables, and multi-turn conversations. To provide the aggregation state required by these tasks, we introduce a model-side aggregation interface that maintains compact Hash-based HyperLogLog (HLL) sketch states alongside a frozen language model. While the model processes the context, an extractor maps each relevant record to a canonical identity. The identity is then hashed and updates the HLL state. These states can be merged across context segments and/or read out directly for downstream reasoning, avoiding an additional generate-execute-return cycle. We validate the proposed approach by setting the HLL state size as 2 KiB (2,048 registers), which does not increase with context length or set cardinality. In a distinct-count experiment involving one million records, the mean relative error was 1.6%. In a separate merge test, states built from as many as 256 segments produced exactly the same readout as a single pass over the same stream. On 3,969 aggregate-then-reason tasks from 174 source windows, the fixed-budget interface reached 99.2% accuracy on Gemma 4 (31B, BF16), compared with 100.0% under exact aggregation; the paired gap was 0.8 percentage points (95% window-cluster CI: 0.5-1.3 points). On a matched set of 174 items, our method improved over direct full-context reasoning by 63.2 points on Qwen and 56.3 points on Gemma. The corresponding gains over chain-of-thought (CoT) reasoning were 60.9 and 63.2 points, respectively. On a fixed 1,200-task Oolong-Synth subset, our method reached 91.1% on Qwen and 99.3% on Gemma. Code is available at https://github.com/songdc98/sketchops.

View source

Similar papers

Conference Open access 2026

A Survey on Context Injection Strategies for Long-Context Language Models: Three Perspectives

This survey argues that context injection strategy, rather than context capacity, is the defining research challenge for long-context LLM deployment, and proposes a three-axis analytical framework revealing that injection performance is jointly governed by selection, representation, and scheduling.

Aicha Dakir, M. El Hajji, Tarek Ait Baha et al. · 0 citations
Preprint Aug 2026

Context as an Environment: Programmatic Context Management for Long-Horizon Agents

LLM agents increasingly take on long-running tasks whose history grows far beyond a single model context window. Existing approaches compress earlier interactions or extract selected information into fixed memory representations, committing to what to preserve before future needs are known. We present Scroll, a context...

Yin Lin, Elaine Ang, E. Zhu et al. · 3 citations
Preprint Jul 2026

TGMS: An Agent-Native Bi-Temporal Graph Management System

TGMS is a bi-temporal property graph management system that exposes thirteen verified temporal operators as agent tools that can answer belief-state questions such as ``as of transaction time $T$, what did the system believe?''

Xiaofei Zhang · 0 citations
Preprint Aug 2026

Structured Memory for Edge Language Models: Persistent Context and Corpus Retrieval via O(1) SSM State Injection

This work introduces PRECOG (Pre-Computed Context Injection), a retrieval mechanism that exploits a property unique to SSMs: the fixed-size, position-agnostic recurrent hidden state is a complete summary of everything the model has read.

Anusha Madan Gopal, Aras Pirbadian, Kristofor D. Carlson et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.