Skip to content
ML Academy

LLMs, GenAI, RAG, agents, evaluation · insight-1533

Retrieve small passages for matching, then expand to the parent section for the generator

Evidence type
practitioner heuristic
Difficulty
medium
Roles
Applied AI, ML engineer
Industries
aviation, insurance

Summary: situation, action, reason, boundary

  1. Situation

    Long sections embed poorly because they mix several topics, but short chunks hand the generator half a rule without its conditions.

  2. Action

    Index small units (a clause or a few sentences) with a parent id, retrieve and rerank on those, then replace hits by their parent section, deduplicate parents and cap the context at a token budget.

  3. Reason

    Matching and reading are different tasks: small units sharpen the match, and the parent restores conditions and exceptions that the small unit cannot carry.

  4. Boundary

    Policies, contracts, manuals and API docs where meaning depends on neighbouring clauses.

Symptom or risk

The index must pick one chunk size for two jobs, matching a query precisely and giving enough surrounding text, and it does neither well.

Exceptions

Corpora made of short self-contained items such as FAQ entries.

Trade-offs

Parent expansion inflates context tokens and can pull in text unrelated to the question.

Pitfalls

Several hits sharing one parent consume the budget repeatedly if parents are not deduplicated first.

Lessons and concepts