# Document Chunking

Document chunking divides source documents into smaller, context-preserving units for indexing, retrieval, and language-model processing.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/document-chunking

> In retrieval-augmented generation (RAG), document chunking determines which passages are embedded, searched, and supplied to a language model as supporting evidence. Effective chunking balances retrieval precision, contextual completeness, model token limits, and operational cost while preserving metadata needed for filtering and citations.

Practice exams covering Document Chunking: [MLA-C02 (beta) AWS Certified Machine Learning Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Document Chunking

Effective document chunking preserves meaning and provenance while balancing retrieval quality, model constraints, and ingestion and query costs.

1. **Context-preserving boundaries**: Choose boundaries that keep related statements, qualifications, and document structure together. Preserve table headers, section titles, and other context that makes a passage understandable on its own.
2. **Size and overlap control**: Set chunk limits with the embedding model's input budget and expected question types in mind. Use overlap selectively to protect boundary-spanning information without creating excessive duplication.
3. **Multiple chunking strategies**: Use fixed-size chunking for predictable processing, structure-aware or semantic chunking for coherent passages, and hierarchical chunking when precise matching requires broader surrounding context. Validate the choice against the actual document collection.
4. **Metadata and provenance**: Attach source identifiers, versions, section information, and relevant filter attributes to each chunk. Keep authorization metadata trustworthy and preserve enough provenance to support useful citations.
5. **Embedding and index compatibility**: Ensure each chunk fits the embedding model's input constraints and the index accepts that model's vector dimensions. Store retrievable text and metadata alongside vectors or maintain reliable references to them.
6. **Measured retrieval optimization**: Tune chunking together with retrieval count, filtering, and reranking using representative questions. Track retrieval quality and answer quality separately, because finding relevant evidence does not guarantee that the model uses it correctly.

## Cloud services for Document Chunking

Amazon S3 holds source documents and associated metadata. Amazon Textract can extract text and layout from scanned inputs, while AWS Lambda can apply custom cleanup, metadata enrichment, or chunking where needed. Amazon Bedrock Knowledge Bases can manage supported ingestion and embedding workflows, with a supported vector store such as an appropriately configured Amazon OpenSearch Service deployment holding searchable chunk representations. During retrieval, the application applies authorized metadata filters, selects relevant passages, and passes their text and provenance to the generation model. Evaluate the complete pipeline together: improved extraction or chunk boundaries can help retrieval, but incorrect vector configuration, stale metadata, or poor context selection can still produce weak answers.

- **[Amazon Bedrock](https://blowstack.com/tools/cloud-services-hub/amazon-bedrock)**: Amazon Bedrock Knowledge Bases manages document ingestion, configurable chunking, embedding generation, and retrieval using supported vector stores. Engineers configure the data source's chunking strategy and metadata, then tune retrieval filters, result counts, and supported reranking options.
- **[Amazon OpenSearch Service](https://blowstack.com/tools/cloud-services-hub/amazon-opensearch-service)**: Amazon OpenSearch Service can index chunk text, metadata, and embeddings for vector and lexical retrieval. Its vector fields, search configuration, and metadata filtering must align with the embedding model and application requirements; chunk creation can occur upstream.
- **[Amazon S3](https://blowstack.com/tools/cloud-services-hub/amazon-s3)**: Amazon S3 stores original documents and preprocessing outputs for RAG ingestion. When used as a Bedrock Knowledge Bases data source, supported metadata sidecar files can supply document attributes that become available for retrieval filtering.
- **[Amazon Textract](https://blowstack.com/tools/cloud-services-hub/amazon-textract)**: Amazon Textract extracts text and structured information from scanned documents and images. Its layout and table information can help preprocessing logic preserve meaningful boundaries instead of splitting an unstructured OCR text stream arbitrarily.
- **[AWS Lambda](https://blowstack.com/tools/cloud-services-hub/aws-lambda)**: AWS Lambda can run custom document transformation and chunking logic, including supported custom transformation integrations with Bedrock Knowledge Bases. Processing must fit Lambda's execution and resource limits; large documents or expensive transformations may require a different compute environment.

## Document Chunking exam questions

Real practice exam questions on Document Chunking, with the correct answer and its explanation.

### Question 1 (MLA-C02 (beta))

**Question:**

A pharmaceutical company is preparing scanned, multipage batch-review reports in Amazon S3 for a RAG application. The first page of each report contains a release-status field with two printed labels, “Released” and “Rejected,” and a checkbox beside each label. Exactly one checkbox is selected, and both labels appear in every report. The selected status applies to the entire report.

The application must restrict retrieval to passages from released reports by using an explicit release_status metadata filter. The engineer must derive this metadata from the scanned form rather than infer it from the report's narrative text.

Which preprocessing approach best meets these requirements?

**Correct answer:** Use Amazon Textract StartDocumentAnalysis with FORMS enabled. Follow the key-value and child relationships to associate each status label with its SELECTION_ELEMENT block, inspect SelectionStatus, and attach the resulting release_status value to every chunk from the report.

**Explanation:** Textract form analysis provides relationships between form fields and selection elements, including whether a checkbox is selected. Associating the selected checkbox with its label determines the report's actual status. Propagating that status to every chunk enables the required metadata filter.

### Question 2 (SAP-C03)

**Question:**

An engineering company uses an Amazon Bedrock knowledge base for a technical-support assistant. Before ingestion, the company separates its manuals into self-contained troubleshooting sections of 1,200–1,800 tokens each. Each section is stored as a separate source document and contains several symptoms, diagnostic procedures, and applicability conditions.

The current knowledge base uses fixed-size, 200-token chunks without overlap. Evaluation shows that retrieval reliably finds passages describing the requested symptom, but generated answers frequently omit applicability conditions located elsewhere in the same section. A previous test that embedded each entire section as a single chunk significantly reduced symptom-level retrieval accuracy.

The company needs to preserve fine-grained matching while supplying the complete associated section as grounding context. It wants to use managed knowledge base ingestion and retrieval without implementing application-side passage expansion.

Which solution best meets these requirements?

**Correct answer:** Create a replacement knowledge base that uses hierarchical chunking with a 2,000-token parent limit and a 200-token child limit. Reingest the source documents and use the managed retrieval behavior that replaces matching child chunks with their parent chunks.

**Explanation:** Hierarchical chunking separates matching granularity from returned context. Small child chunks support precise symptom matching, while retrieval returns their larger parent chunks. Because each source document is a self-contained section smaller than the parent limit, the parent can preserve the section's procedures and applicability conditions without custom passage expansion.

## Practice Document Chunking in a full exam

Questions on Document Chunking in each practice exam, with every answer option and an explanation for each:

- [MLA-C02 (beta)](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate): 8 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 2 questions

## What is Document Chunking

Document chunking is a preprocessing step that turns documents into retrievable passages. A typical RAG ingestion pipeline extracts text, removes unwanted formatting, divides the text into chunks, attaches metadata, generates embeddings, and writes the results to a searchable index. At query time, the application retrieves relevant chunks and supplies their text to a language model. Chunking is not summarization: it generally partitions source content rather than replacing it with a shorter interpretation.

Fixed-size chunking divides text using a token or character limit, often with overlap between adjacent chunks. Token-based limits are useful because embedding and generation models enforce token budgets, although different models can use different tokenizers. Structure-aware chunking follows headings, paragraphs, sentences, or document sections. Semantic chunking identifies boundaries based on changes in meaning. Hierarchical chunking creates smaller child passages within larger parent sections so retrieval can locate precise evidence while returning broader context.

For example, a maintenance manual might describe an error code in one paragraph and its required safety precautions in the next. Splitting exactly between those paragraphs could retrieve the repair procedure without the warning. Preserving the section or adding controlled overlap can keep the instructions together. Tables require similar care: a row of values without its column headers or units may be misleading. Scanned documents often need optical character recognition and layout extraction before useful chunk boundaries can be selected.

Small chunks can isolate relevant facts, but they may lose definitions, qualifications, or relationships that span passages. Large chunks preserve more context but can dilute embedding relevance and consume more of the generation model's context window. Overlap reduces boundary-related information loss, yet increases embedded text volume, storage, and potentially redundant retrieval results. There is no universally correct chunk size or overlap percentage. A starting configuration such as 500-token chunks with 50-token overlap is an experiment, not a standard.

Metadata should preserve provenance and useful retrieval constraints. Common fields include the source URI, document identifier, title, heading path, page number where available, version, timestamp, language, and access-control labels. Document-level metadata can be inherited by chunks, while section or page metadata may need extraction during parsing. Metadata filters can restrict results to the correct product version or tenant, but sensitive-content access must be enforced through trusted authorization logic rather than relying on the model to ignore unauthorized passages.

In a cloud implementation, object storage can hold source files while managed ingestion or custom compute performs parsing and chunking. A vector database stores chunk embeddings together with text and metadata, or references to that text. Configure the vector field dimension to match the embedding model and select supported indexing and similarity settings appropriate to that model. Chunk size and embedding dimensionality are separate decisions: changing the number of tokens in a chunk does not change the model's output vector dimension.

Amazon Bedrock Knowledge Bases supports fixed-size, semantic, hierarchical, and no-chunking configurations for supported ingestion paths. No chunking treats each document as one chunk; it does not remove embedding-model input limits. Select the strategy when configuring the data source, because its chunking configuration cannot subsequently be changed in place. A different strategy requires a new data source and re-ingestion. With hierarchical retrieval, replacing matching child chunks with their parents can produce fewer returned results than the requested retrieval count.

Evaluate chunking with representative questions and known supporting passages. Measure evidence recall, answer correctness, citation quality, latency, and cost while varying chunk boundaries, overlap, retrieval count, metadata filters, and reranking. Retrieving more chunks does not automatically improve answers: duplicates and irrelevant context can crowd out useful evidence. Version the parsing and chunking configuration, and reprocess affected documents when it changes so the index remains consistent with the intended retrieval behavior.

## Learn Document Chunking in lessons

2 short lessons on Document Chunking in 2 certification courses.

- MLA-C02 (beta): Document Chunking: designing retrievable passages (Premium), https://app.blowstack.com/lessons/document-chunking-designing-retrievable-passages-mla-c02
- SAP-C03: Document Chunking: designing retrieval-ready passages (Premium), https://app.blowstack.com/lessons/document-chunking-designing-retrieval-ready-passages-sap-c03
