LumberChunker: Long-Form Narrative Document Segmentation

André V. Duarte, João Marques, Miguel Graça, Miguel Freire, Lei Li, Arlindo L. Oliveira · DOI

Abstract

Effective Retrieval-Augmented Generation (RAG) depends heavily on the quality of document segmentation. While standard recursive splitting methods are computationally efficient, they often fail to preserve the semantic continuity of narrative texts. We present LumberChunker, a novel segmentation method that leverages Large Language Models (LLMs) to dynamically identify semantic boundaries. By treating document splitting as a content-aware reasoning task, LumberChunker achieves a 7.37% improvement in retrieval performance over traditional baselines and approaches human-level accuracy in end-to-end question-answering tasks.

Introduction

In the architecture of Retrieval-Augmented Generation (RAG) systems, the "chunking" strategy is a critical determinant of performance. If chunks are too granular, they lose the surrounding context necessary for accurate reasoning; if they are too coarse, they introduce irrelevant noise that degrades retrieval precision.

Most contemporary systems utilize "naive" chunking—splitting text based on fixed character or token counts. While advanced techniques like "proposition-level" chunking (breaking text into atomic facts) have shown promise for factual, Wikipedia-style corpora, they often fail on narrative documents such as books or long-form reports. In these contexts, the flow of the story and the connective tissue between paragraphs are essential for comprehension. LumberChunker addresses this by using an LLM to determine natural breaking points where content begins to diverge semantically.

Methodology

LumberChunker operates through a three-step iterative process designed to balance context window constraints with semantic integrity:

  1. Paragraph Segmentation: The source document is first decomposed into its constituent paragraphs, with each assigned a unique identifier.
  2. Dynamic Grouping: Paragraphs are sequentially concatenated into a group ($G_i$) until the total count reaches a predefined token threshold ($\theta$).
  3. LLM-Guided Splitting: This group is passed to an LLM (Gemini 1.0-Pro) with a specific prompt. The model is tasked with identifying the exact paragraph ID where the narrative focus "clearly changes" relative to the preceding text.

This identified transition point serves as the boundary for the current chunk. The next iteration begins immediately following this boundary. This "content-aware" approach allows chunk sizes to fluctuate naturally based on the logic of the narrative rather than rigid structural constraints.

Experimental Setup

To evaluate the efficacy of LumberChunker on long-form narratives, the researchers introduced GutenQA, a new benchmark consisting of 100 public domain books from Project Gutenberg. This dataset includes 3,000 high-quality "needle in a haystack" question-answer pairs.

Additionally, a specialized Autobiographies Test Set featuring 280 questions from four narrative autobiographies (including those of Mahatma Gandhi and Helen Keller) was used to measure the impact of chunking on final generation accuracy in a full RAG pipeline.

Key Insights

The Importance of Semantic Independence

The core hypothesis of LumberChunker is that retrieval efficiency is maximized when chunks are semantically independent. By allowing an LLM to "read" the transitions, the system avoids the common pitfall of cutting a narrative mid-thought, ensuring that each retrieved segment is a self-contained unit of meaning.

The Narrative Penalty

The study found that "Proposition-level" chunking—often considered state-of-the-art for factual data—performs poorly on narratives. By stripping away pronouns and narrative flow to create atomic facts, these methods lose the very context that makes a story retrievable.

The "Goldilocks" Window

Experimental results identified a context window ($\theta$) of approximately 550 tokens as the optimal threshold. Windows smaller than this did not provide the LLM with enough context to identify a meaningful shift, while larger windows tended to overwhelm the model's reasoning capabilities, leading to degraded boundary detection.

Results

LumberChunker demonstrated significant improvements across both retrieval and generation metrics:

  • Retrieval Performance: On the GutenQA benchmark, LumberChunker achieved a DCG@20 of 62.09, representing a 7.37% improvement over the most competitive baseline (Recursive Chunking at 54.72).
  • End-to-End Accuracy: In a full RAG pipeline, LumberChunker reached an answer accuracy of 88.89%. This significantly outperformed standard Recursive RAG (84.96%) and came remarkably close to the "Gold Standard" of manual human-curated chunking (90.53%).

Limitations and Conclusion

Despite its performance gains, LumberChunker introduces a trade-off in computational cost and latency. Because the method requires sequential LLM calls, it is significantly slower than rule-based splitters. For instance, processing a large novel like The Count of Monte Cristo took approximately 27 minutes, compared to sub-second processing for traditional methods. Furthermore, the linear nature of the algorithm makes it difficult to parallelize.

In conclusion, LumberChunker represents a significant step forward for RAG systems dealing with complex, long-form narratives. While the latency remains a challenge for real-time applications, the gains in retrieval quality and semantic integrity provide a new benchmark for high-accuracy document processing.

Summary updated

BibTeX
@inproceedings{duarte2024lumberchunker,
  author = {André V. Duarte and João Marques and Miguel Graça and Miguel Freire and Lei Li and Arlindo L. Oliveira},
  title = {{LumberChunker: Long-Form Narrative Document Segmentation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.377},
}
Figure