LearnAI
Module 5 · RAG in Depth (Pro) · Lesson 1/6
← Back to catalog
Task

Chunking: how to cut documents

What's wrong with this chunking and how can I fix it? Return JSON {"problem": "problem", "fix": "how to fix"}.

Unlock access to submit solutions for instant AI review.Start for free
The basis of a quality RAG
💡 A bit of theory

RAG starts with cutting documents into pieces (chunks) - it’s impossible to put the entire database into context (it’s expensive and won’t fit). The way you cut it, it will be found. Chunks that are too large blur the meaning and burn tokens; too small ones lose context (a piece of a sentence without support). Good practice: cut along semantic boundaries (paragraphs, sections), and not blindly according to characters, and add an overlap (overlap) so that the idea at the junction of two chunks is not lost. Metadata (source, section) is attached to each chunk for filtering and references. Bad chunking is the main reason why "RAG doesn't find the obvious."

How it's graded · passing score 70

  • 1Valid JSON without text around it30%
  • 2There are fields problem and fix35%
  • 3100 characters lose context; cut according to meaning + overlap35%
Your promptClaude ⌄