RAG & Knowledge Retrieval10 min read• Published July 08, 2026

Retrieval-Augmented Generation (RAG) Foundations: Document Layout Parsing & Chunking Strategies

Converting raw document sources into structured text, fixed vs semantic chunking strategies, and small-to-big parent retrieval.

GS
Govindarajan Selvaraj
ML Engineer

⚡ Executive Summary

A deep dive into document ingestion: PDF layout structure parsing, fixed-size vs semantic chunking, and small-to-big parent document retrieval.

Key Takeaways

  • Why RAG Exists — covered in depth with practical examples, formulas, and code.
  • Chunking Taxonomy — covered in depth with practical examples, formulas, and code.

RAG Foundations — Document Parsing & Chunking

text
Indexing Pipeline
Raw Docs → Parsing → Chunking → Embeddings → Vector Database

#1. Why RAG Exists

LLM knowledge is frozen at training cutoff. RAG retrieves relevant information from external data stores at query time, turning the LLM into an open-book exam taker.


#2. Chunking Taxonomy

  • Fixed-Size Chunking: Splits every N tokens with overlap (e.g. 500 tokens with 50 overlap).
  • Recursive Chunking: Splits along hierarchical structural separators (paragraphs → sentences → words).
  • Semantic Chunking: Starts a new chunk whenever sentence embedding cosine similarity drops.
  • Small-to-Big Retrieval: Searches small chunks (100 tokens) for vector precision, but passes the parent section (1,000 tokens) to the LLM for context.
  • python
    from langchain_text_splitters import RecursiveCharacterTextSplitter
    splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
    chunks = splitter.split_text(document_text)
    Tags:#RAG#Chunking#Document Parsing#Semantic Chunking#Indexing
    ABOUT THE AUTHOR
    GS

    Govindarajan Selvaraj

    ML Engineer

    Govindarajan Selvaraj is part of the Junglans Solutions engineering team, specializing in rag & knowledge retrieval. Junglans builds a 20-product ecosystem of local-first enterprise software — AI developer tools, encrypted communication, and data infrastructure with zero cloud telemetry.

    Meet the full Junglans engineering team ↗
    RELATED RESOURCES & REFERENCES

    This article is part of the Junglans Research knowledge base, produced alongside the engineering teams that build our production AI tools. Explore related product documentation and research:

    Related Research & Articles