Choosing Parsing and Chunking Strategies
This lesson explains how a knowledge base's parsing and chunking options decide what a search result contains, and how to choose them so tables, images and answers are not lost or split.
Learning outcomes
After completing this lesson, you will be able to:
- Choose a parser for complex documents.
- Choose between default, fixed-size, hierarchical and semantic chunking.
- Customize chunking with a Lambda function.
Parsing options
The default parser extracts text from common formats such as text, HTML, Markdown, Word and text-based PDF. Documents with complex layouts, tables, charts or scanned pages need advanced parsing. The Bedrock Data Automation parser handles multimodal content such as tables, figures and images in documents. The foundation model parser uses a multimodal model with a customisable parsing prompt, for example to convert tables to Markdown or describe charts. Extracted images can be stored in a supplemental S3 location for multimodal retrieval. Advanced parsing adds cost per page, so it is applied to the data sources that need it.
The following diagram compares the original ingestion with the corrected one.

Choosing a parser
Chunking strategies
Default chunking splits text into chunks of about 300 tokens, respecting sentence boundaries. Fixed-size chunking sets a maximum number of tokens per chunk and an overlap percentage between consecutive chunks, so sentences near boundaries appear in both. Hierarchical chunking creates large parent chunks and smaller child chunks inside them; search runs on child chunks for precision, and the matching parent chunks are returned for context. Semantic chunking uses embeddings to split where meaning changes, controlled by a maximum chunk size, a buffer size (surrounding sentences considered) and a breakpoint percentile threshold. No chunking treats each file as one chunk, for content already split upstream.
"chunkingConfiguration": {
"chunkingStrategy": "HIERARCHICAL",
"hierarchicalChunkingConfiguration": {
"levelConfigurations": [{"maxTokens": 1500}, {"maxTokens": 300}],
"overlapTokens": 60
}
}The following diagram shows how the three strategies divide the same document.

300tokens
About the size of a default chunk
Choose the chunking strategy
Custom chunking with Lambda
A custom transformation Lambda function runs during ingestion when built-in strategies do not fit, for example to split on document headings, keep each FAQ question with its answer, keep tables whole, prepend section titles to chunks or add computed metadata. The knowledge base writes intermediate files to an S3 bucket, invokes the function, and reads the transformed chunks back. Custom chunking can be combined with built-in chunking or used instead of it.
The chunking strategy of a data source cannot be changed after the data source is created. Changing it requires a new data source (or knowledge base) and a full ingestion, so the choice should be evaluated during the proof of concept. The following table summarises the strategies.
| Strategy | How it splits | Best for |
|---|---|---|
| Default | About 300 tokens, sentence aware | General text; quick start |
| Fixed-size with overlap | Max tokens plus overlap percentage | Uniform prose; predictable sizes |
| Hierarchical | Child chunks searched, parent chunks returned | Precise matching with rich context |
| Semantic | Breaks where meaning changes | Documents mixing many topics |
| None | Whole file is one chunk | Pre-split content such as single FAQ entries |
| Custom Lambda | Any logic you implement | Headings, tables, Q&A pairs, special formats |
Custom chunking
Tables split across chunks
Product manuals contain specification tables. Answers about specifications are often wrong, and inspection shows that retrieved chunks contain half a table with no column headers.
Two fixes are needed: an advanced parser (Bedrock Data Automation or the foundation model parser) to extract tables faithfully, for example as Markdown, and custom chunking (or hierarchical chunking with large parents) that keeps each table whole with its heading. Because chunking cannot be changed in place, a new data source is created and synced.
Which chunking strategy returns precise matches with enough surrounding context?
Show answer
Hierarchical chunking, which searches small child chunks and returns their larger parent chunks.
Exam Tips
Remember for the exam
- Complex layouts, tables and images: Bedrock Data Automation or foundation model parser.
- Precise matches with enough context: hierarchical chunking.
- Headings, Q&A pairs or whole tables: custom Lambda chunking.
- Chunking cannot be changed on an existing data source.