Aulafy
Courses/Advanced and secure RAG/Advanced Chunking for Private RAG

Advanced Chunking for Private RAG

Many RAG systems fail before they reach the model: they cut paragraphs in half, lose headings, mix topics, and don't store metadata. Advanced chunking means preserving meaning, not just counting tokens.

  • Avoid fixed-size chunks that split ideas.
  • Store headings, page, document, date, and permissions.
  • Evaluate retrieval with real questions.
TerminalCode
chunk:
  text: "El cliente puede devolver el producto durante 14 días..."
  metadata:
    document_id: "politica-devoluciones"
    heading_path: ["Atención al cliente", "Devoluciones"]
    page: 3
    language: "es"
    updated_at: "2026-07-05"
    tenant_id: "acme"
    source_url: "docs/devoluciones.pdf"

Practical rules

  • Split by sections, paragraphs, and sentences before fixed size.
  • Use overlap when an explanation continues across chunks.
  • Don't mix tables, legal notes, and narrative in the same fragment.
  • Store metadata to filter before searching.
  • Evaluate with questions users would actually ask.
TerminalCode
eval_recuperacion:
  pregunta: "¿Cuántos días tengo para devolver un producto?"
  debe_recuperar:
    - document_id: "politica-devoluciones"
      heading: "Devoluciones"
  no_debe_recuperar:
    - "garantias"
    - "envios"

Official sources

  • Qdrant documentation
  • Qdrant filtering
  • Chunkr GitHub
  • Chunkr docs