SEGMENT+: Long Text Processing with Short-Context Language Models

Wei Shi, Shuang Li, Kerun Yu, Jinglei Chen, Zujie Liang, Xinhui Wu, Yuxi Qian, Feng Wei, Bo Zheng, Jiaqing Liang, Jiangjie Chen, Yanghua Xiao

Abstract

As Large Language Models (LLMs) scale, the industry has engaged in a "context window arms race," pushing models to process hundreds of thousands of tokens. However, simply expanding the window size often leads to diminishing returns due to the "lost in the middle" phenomenon and increased computational noise. This paper introduces SEGMENT+, a model-agnostic framework that enables short-context LLMs to process massive documents effectively. By utilizing a hierarchical note-taking and filtering mechanism, SEGMENT+ separates raw evidence from high-level reasoning, allowing models to maintain high precision and recall across long-range dependencies.

Introduction

Modern LLMs are increasingly evaluated on their ability to handle long-form content, from entire books to extensive codebases. Despite the availability of models with 128k or even 1M token windows, performance often degrades as context length increases. This degradation is typically caused by two factors: the "lost in the middle" effect, where models struggle to retrieve information from the center of a prompt, and the accumulation of irrelevant "noise" that distracts the model's reasoning capabilities.

SEGMENT+ addresses these challenges by treating the LLM as an active agent that manages information rather than a passive reader. Instead of feeding a massive document into a single prompt, SEGMENT+ breaks the text into manageable segments and employs a structured information-processing pipeline to distill relevant insights.

Methodology

The SEGMENT+ framework operates through a three-stage pipeline designed to filter noise and compress information without losing critical details.

1. Gathering and Filtering

The input document is partitioned into discrete chunks. For each chunk, the LLM generates a structured Note in JSON format. This note contains two distinct fields:

  • Evidence: Direct, verbatim sentences from the text to ensure precision.
  • Reasoning: A concise summary of entities, events, and their relationships to ensure high recall and compression.

A dedicated filtering module then evaluates these notes, labeling them as "Keep" or "Remove." This step prunes segments that do not contribute to the specific query, effectively acting as a signal booster.

2. Hierarchical Merging

To prevent information loss during the compression phase, notes labeled "Keep" are merged hierarchically in batches. The model synthesizes the evidence and refines the reasoning while strictly maintaining the original document's chronological or logical order. This iterative process continues until the total token count of the distilled notes fits within the model's native context window.

3. Question Answering

In the final stage, the condensed set of structured notes is provided to the LLM. Because the input has been stripped of noise and organized into high-density evidence and reasoning, the model can generate an answer with significantly higher accuracy than if it had processed the raw, uncompressed text.

Experimental Evaluation

Researchers evaluated SEGMENT+ using a variety of long-text benchmarks to test both retrieval and complex reasoning:

  • Long Document QA: Datasets from Scrolls and Longbench, including Quality (narrative comprehension), NarrativeQA (scripts and books), Qasper (scientific papers), and HotpotQA/Musique (multi-hop reasoning).
  • Needle-in-a-Haystack: The Babilong benchmark was used to test the extraction of facts hidden within up to 128k tokens of noise.

Key Results

SEGMENT+ demonstrated significant performance gains across all tested models, including smaller parameters models like Vicuna-7B and state-of-the-art models like GPT-4.

  • Performance Gains: On standard long-document QA tasks, SEGMENT+ provided a 20% performance improvement over vanilla (unaugmented) models.
  • Surpassing Native Windows: Remarkably, GPT-4 utilizing the SEGMENT+ framework achieved a 5.28% higher accuracy on the Babilong benchmark than vanilla GPT-4 using its native 128k context window. This suggests that structured management of information is more effective than simply increasing raw window size.
  • Stability at Scale: While vanilla models often see performance plummet as context length exceeds 32k tokens, SEGMENT+ remained stable, maintaining consistent accuracy even at the 128k token limit.

Discussion and Limitations

The success of SEGMENT+ lies in its ability to distinguish between what a text says (Evidence) and what it means (Reasoning). This distinction prevents hallucinations and allows smaller models to outperform much larger counterparts by focusing their limited attention on high-value information.

However, the framework has limitations. It relies heavily on the model's ability to follow complex instructions and output valid JSON. Consequently, very small or "weak" models may struggle with the note-taking format. Additionally, the current implementation is optimized for natural language documents and may require further adaptation for structured data like source code or interactive environments.

Conclusion

SEGMENT+ offers a scalable, model-agnostic solution to the long-context problem. By shifting the focus from context window size to information management, the framework enables high-precision reasoning over massive datasets. Future work will explore adapting the "Evidence + Reasoning" schema for other modalities, such as long-term memory in autonomous agents and video processing.

Summary updated

BibTeX
@inproceedings{shi2024segment,
  author = {Wei Shi and Shuang Li and Kerun Yu and Jinglei Chen and Zujie Liang and Xinhui Wu and Yuxi Qian and Feng Wei and Bo Zheng and Jiaqing Liang and Jiangjie Chen and Yanghua Xiao},
  title = {{SEGMENT+: Long Text Processing with Short-Context Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.926},
}
Figure