AWS Certified Generative AI Developer – Professional
Bedrock Knowledge Bases chunking strategies for AIP-C01
A knowledge base splits each document into chunks, embeds each chunk and stores the vectors. Pick fixed-size or default chunking for plain text, hierarchical when answers need the surrounding section, semantic to split on meaning, and no chunking when each file is already one unit. The chunking strategy is set when the data source is created and can't be changed afterwards.
The strategies
Default chunking splits content into chunks of about 300 tokens and keeps whole sentences together.
Fixed-size chunking lets you set the maximum tokens per chunk and an overlap percentage between consecutive chunks.
Hierarchical chunking creates child chunks inside parent chunks. You set the parent size, the child size and the overlap tokens. Retrieval searches the child chunks, then replaces them with their parent chunk so the model gets more context. Because several children can share one parent, a query can return fewer results than numberOfResults asked for. AWS does not recommend hierarchical chunking with an S3 vector bucket as the vector store.
Semantic chunking splits text where the meaning changes. You set maximum tokens, a buffer size (how many neighbouring sentences are embedded together) and a breakpoint percentile threshold. A higher threshold gives fewer, larger chunks. It costs extra because it uses a foundation model.
No chunking treats each document as one chunk. AWS suggests splitting documents into separate files first. With no chunking you cannot see page numbers in citations or filter on the page-number metadata field.
Your own chunking logic
If no built-in strategy fits, choose no chunking and add a custom transformation Lambda function. You also give the knowledge base an S3 bucket for intermediate storage. The function reads the files, writes chunked files back to the same bucket and returns references, and the knowledge base continues ingestion from there.
For example, to make each chunk exactly one contract clause, set no chunking and let the Lambda function split at clause numbers. If you only want to add chunk-level metadata, keep a built-in strategy such as fixed-size and use the Lambda function after chunking. Chunk-level metadata overrides file-level metadata when keys collide.
Changing the strategy later
The UpdateDataSource API reference says you can't change chunkingConfiguration after you create the data source. To move existing documents to a new strategy and keep the same knowledge base ID, add a second data source over the same S3 location with the new strategy, ingest it, test it, then delete the old data source. If the old data source uses the DELETE data deletion policy, its chunks are removed from the vector store.
Where the exam catches people
- Believing UpdateDataSource can switch fixed-size chunking to hierarchical: chunkingConfiguration is fixed when the data source is created.
- Believing hierarchical chunking always returns numberOfResults chunks: children that share a parent are replaced by that one parent, so fewer results can come back.
- Believing custom chunking in Lambda works with fixed-size chunking set: to apply your own split, choose no chunking and add the custom transformation with an S3 bucket.
- Believing semantic chunking costs the same as fixed-size: it uses a foundation model, which adds cost based on the amount of data.
- Believing no chunking keeps page-number citations: with no chunking you cannot view page numbers in citations or filter on the page-number field.