Exam Room · Advanced Generative AI Developer

Pop Quiz: Hierarchical Chunking in One Line

· 4 min read

Exam-style

A Bedrock Knowledge Base ingests 600-page equipment manuals with numbered procedures. Small fixed chunks retrieve the right step but the answer stops halfway through the procedure; large chunks carry the whole procedure but stop being retrieved at all. Which chunking strategy resolves this?

Reveal the answer

D. Hierarchical chunking, matching on the small child chunk and returning its parent chunk to the model

Hierarchical chunking indexes small child chunks for precise matching. At retrieval it replaces each matched child with the parent chunk that contains it, so the embedding stays focused on one step while the whole procedure reaches the model. Both levels take a maximum chunk size of up to 8,192 tokens, and because several children can collapse into one parent, a query may return fewer results than top-k requested. The other options each pick a side of the size trade rather than resolving it. Bigger fixed chunks and a high semantic threshold both dilute the embedding again, top-k 20 helps only when the adjacent chunks also rank in the top 20, and one 600-page manual as a single chunk runs past the 8,192-token input limit of an embedding model such as Titan Text Embeddings V2.

Generative AI Development · part of The Exam Room

Q. Answers get cut across chunk boundaries in a long structured PDF. Best Bedrock KB chunking?

A. Hierarchical chunking: match the small child chunk for precision, then return the parent chunk that contains it for context. It resolves the size trade instead of picking a side of it.

Why? Small chunks match precisely but lose context; large chunks dilute the embedding. Hierarchical indexes the child and returns the parent, with each level capped at 8,192 tokens. Several children can collapse into one parent. A query may then return fewer results than top-k asked for.

These posts are LLM-aided. Backbone, original writing, and structure by Craig. Research and editing by Craig + LLM. Proof-reading by Craig.