Manuscript Offprint

arXiv:2504.19754

Reconstructing Context: Evaluating Advanced Chunking Strategies for Retrieval-Augmented Generation

Carlo Merola, Jaspinder Singh

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Carlo Merola [0009−0000−1088−1495]^{[0009-0000-1088-1495]} and Jaspinder Singh [0009−0000−5147−1249]^{[0009-0000-5147-1249]} *

Department of Computer Science and Engineering, University of Bologna carlo.merola@studio.unibo.it, jaspinder.singh@studio.unibo.it

Abstract. Retrieval-augmented generation (RAG) has become a transformative approach for enhancing large language models (LLMs) by grounding their outputs in external knowledge sources. Yet, a critical question persists: how can vast volumes of external knowledge be managed effectively within the input constraints of LLMs? Traditional methods address this by chunking external documents into smaller, fixed-size segments. While this approach alleviates input limitations, it often fragments context, resulting in incomplete retrieval and diminished coherence in generation. To overcome these shortcomings, two advanced techniques—late chunking and contextual retrieval—have been introduced, both aiming to preserve global context. Despite their potential, their comparative strengths and limitations remain unclear. This study presents a rigorous analysis of late chunking and contextual retrieval, evaluating their effectiveness and efficiency in optimizing RAG systems. Our results indicate that contextual retrieval preserves semantic coherence more effectively but requires greater computational resources. In contrast, late chunking offers higher efficiency but tends to sacrifice relevance and completeness.

Keywords: Contextual Retrieval · Late Chunking · Dynamic Chunking · Rank Fusion.

1 Introduction

Retrieval Augmented Generation (RAG) is a transformative approach that enhances the capabilities of large language models (LLMs) by integrating external information retrieval directly into the text generation process. This method allows LLMs to dynamically access and utilize relevant external knowledge, significantly improving their ability to generate accurate, contextually grounded, and informative responses. Unlike static LLMs that rely solely on pre-trained data, RAG-enabled models can access up-to-date and domain-specific information. This dynamic integration ensures that the generated content remains both relevant and accurate, even in rapidly evolving or specialized fields.

∗^{*} Equal contribution.

J. Singh and C. Merola

RAG models combine two key components: a retrieval mechanism and a generative model. The retrieval mechanism fetches relevant documents or data from a large corpus, while the generative model synthesizes this information into coherent, contextually enriched answers. This synergy enhances performance in knowledge-intensive natural language processing (NLP) tasks, enabling models to produce well-informed responses grounded in the retrieved data.

The Context Dilemma in Classic RAG: Managing extensive external documents poses significant issues in RAG systems. Despite advancements, many LLMs are limited to processing a few thousand tokens. Although some models have achieved context windows up to millions of tokens [5], these are exceptions rather than the norm. Moreover, research indicates that LLMs may exhibit positional bias, performing better with information at the beginning of a document and struggling with content located in the middle or toward the end [11,16]. This issue is exacerbated when retrieval fails to prioritize relevant information properly. Thus, documents are often divided into smaller segments or "chunks" before embedding and retrieval. However, this chunking process can disrupt semantic coherence, leading to:

– Loss of Context: dividing documents without considering semantic boundaries can result in chunks that lack sufficient context, impairing the model's ability to generate accurate and coherent responses.

– Incomplete Information Retrieval: important information split across chunks may not be effectively retrieved or integrated.

To address these issues, we analyse and compare two recent techniques—contextual retrieval 1^{1} and late chunking [9]—within a unified setup, evaluating their strengths and limitations in tackling challenges like context loss and incomplete information retrieval. Contextual retrieval preserves coherence by prepending LLM-generated context to chunks, while late chunking embeds entire documents to retain global context before segmenting.

Our study rigorously assesses their impact on generation performance in question-answering tasks, finding that neither technique offers a definitive solution. This work highlights the trade-offs between these methods and provides practical guidance for optimizing RAG systems.

To further support the community, we release all code, prompts, and data under the permissive MIT license, enabling full reproducibility and empowering practitioners to adapt and extend our work. 2^{2}

References (22)