Using Document Layout Structure for Efficient RAG
The remarkable capabilities of large language models (LLMs) open up incredible opportunities for analyzing documents at scale. However, making the text in documents, especially large PDFs available for LLM has been a challenge due to the amount of text the LLM can analyze at a time (a.k.a LLM context window). There are broadly two approaches to solve the problem: Convert documents to raw text and break down the text into small chunks of texts, usually less than the LLM context window size (approx 2000-3000 words). There is a growing body of research in making LLMs work with much larger contexts that scale up to several hundred pages of text. Both the options have severe drawbacks, which I will discuss below. At this point, if you’d like to go straight the solution, here’s the github link. Let’s look at naive chunking. Documents express their meaning through their layout: Headings and nested subheadings represent a theme that describes all the text underneath. The picture below illustra
Using Document Layout Structure for Efficient RAG Chunking documents by their logical layout structure improves LLM performance on large documents. Ambika Sukla Oct 19, 2023 38 11 4 Share The remarkable capabilities of large language models (LLMs) open up incredible opportunities for analyzing documents at scale. However, making the text in documents, especially large PDFs available for LLM has been a challenge due to the amount of text the LLM can analyze at a time (a.k.a LLM context window). There are broadly two approaches to solve the problem: Convert documents to raw text and break down t
Explore this link on the map →related reading
- LangChain ParentDocumentRetriever: Strike a Balance between large vs small chunks | ClusteredBytesclusteredbytes.pages.dev
- Retrieval-Augmented Generation for Large Language Models: A Surveyarxiv.org
- Reducto: The Agentic Document Platform for AI Teamsreducto.ai
- Building A RAG Pipeline for Semi-structured Data with Langchain - Analytics Vidhyaanalyticsvidhya.com
- Recursive Language Models | Alex L. Zhangalexzhang13.github.io
- Patterns for Building LLM-based Systems & Productseugeneyan.com
- Advanced Retriever Techniques to Improve Your RAGs | Towards Data Sciencetowardsdatascience.com
- RAG Chunk Size Guide: Find The Best Setting | LlamaIndexblog.llamaindex.ai
- Building Performant RAG Applications for Production | Developer Documentationdocs.llamaindex.ai
- Generalizing an LLM from 8k to 1M Context using Qwen-Agent | Qwenqwenlm.github.io
- Towards Data Sciencetowardsdatascience.com
- Late Chunking in Long-Context Embedding Modelsjina.ai