CLOUD CONCEPT

Fixed-Size Chunking

Fixed-size chunking divides documents into segments using a predetermined length, usually measured in tokens, optionally with overlap between adjacent segments.

Cloud Concepts Hub →

What is Fixed-Size Chunking

Fixed-size chunking creates predictable retrieval units for embedding, indexing, and retrieval-augmented generation (RAG). Chunk size and overlap influence whether retrieved passages contain enough context, how precisely they match questions, and how much storage and model processing the pipeline requires.

Fixed-size chunking segments document content according to a configured length rather than identifying topic changes or constructing a hierarchy from headings. Length can be measured in characters, words, or tokens; token-based sizing is particularly useful for foundation-model applications because embedding and generation models impose token limits. Implementations may enforce exact windows or treat the configured size as a maximum while preserving sentence boundaries. The final chunk is commonly shorter than the configured size.

In a cloud retrieval pipeline, documents are extracted into text, normalized, segmented, embedded, and indexed. Each chunk becomes a searchable unit associated with its source document and metadata. At query time, the application retrieves relevant chunks and places selected passages into the foundation model's context. Chunking therefore determines what evidence the retriever can return independently; a relevant document is not enough if its individual chunks separate the information needed to answer the question.

For example, a custom splitter could create 500-token windows with 75 tokens of overlap. The first window covers token positions 1 through 500, and the next starts at position 426. This overlap helps preserve a definition or instruction that crosses a boundary. It also duplicates text across embeddings and retrieved passages, increasing index size and potentially wasting generation context. The stride is the chunk size minus the overlap, and overlap must remain smaller than the chunk size.

Managed ingestion systems can implement this strategy without custom splitting code. Amazon Bedrock Knowledge Bases supports fixed-size chunking configured with a maximum token count and an overlap percentage. AWS Lambda can implement custom segmentation when an application needs specific tokenization, normalization, metadata, or boundary behavior. A custom pipeline should use token counting appropriate to the embedding model rather than assuming a fixed number of characters equals a fixed number of tokens. For large files or processing that exceeds function execution limits, use an appropriately sized batch or container workload.

Smaller chunks can improve retrieval precision by isolating a specific fact, but may remove qualifications, headings, or surrounding explanation. Larger chunks retain more context but can combine unrelated topics and weaken the specificity of an embedding. A troubleshooting guide might work well with moderate fixed-size passages, while a legal policy could split an exception from the rule it modifies. Tables and source code also require care because arbitrary boundaries can separate labels from values or declarations from their use.

Fixed-size chunking is not semantic chunking, and adding overlap does not make it structure-aware. Hierarchical chunking instead maintains relationships between smaller retrieval units and larger parent sections, allowing retrieval of focused evidence with broader context. If questions routinely require an entire procedure or section, structure-aware or hierarchical processing may fit better than increasing the fixed window everywhere.

There is no universally optimal chunk size. Evaluate representative questions using retrieval recall, ranking quality, answer correctness, citation accuracy, latency, and cost. Keep the total prompt within the generation model's context budget, including instructions, history, retrieved passages, and reserved output space. Preserve document identifiers, source locations, version information, and access-control metadata on every chunk. Apply authorization filtering during retrieval; chunking itself neither enforces access control nor removes sensitive data. Version the splitter configuration and rebuild affected embeddings when segmentation changes so that stale and current chunks do not coexist unintentionally.

Key aspects of Fixed-Size Chunking

Fixed-size chunking offers predictable retrieval units, with size, overlap, boundary handling, and metadata determining their practical usefulness.

Explicit size units

Define whether length means tokens, words, or characters, and whether the setting is an exact window or a maximum. Token-based sizing must account for the embedding model's input limit and tokenizer behavior.

Configurable overlap

Repeat a portion of adjacent chunks to reduce information loss at boundaries. Balance that benefit against duplicated embeddings, index growth, and redundant retrieved context.

Retrieval granularity

Chunk size controls the amount of evidence retrieved as one unit. Smaller chunks favor focused matches, while larger chunks retain more surrounding context but may mix topics.

Predictable segmentation rules

A fixed sizing rule provides a straightforward baseline that is easy to implement and compare across experiments. Record the tokenizer, size, overlap, and preprocessing version to make ingestion reproducible.

Limited structural awareness

Length-based boundaries can split sentences, procedures, tables, or qualifications unless additional boundary rules are applied. Use structure-aware or hierarchical segmentation when document relationships are essential to answering questions.

Metadata and lifecycle preservation

Attach source identifiers, locations, versions, and authorization metadata to each chunk. Ensure updates and deletions propagate to all derived chunks and embeddings.

Cloud services for Fixed-Size Chunking

A typical pipeline stores source documents in Amazon S3 and uses either Amazon Bedrock Knowledge Bases for managed segmentation or AWS Lambda for custom fixed-size splitting. The resulting chunks receive embeddings and source metadata before being indexed in a retrieval backend such as Amazon OpenSearch Service. At query time, the application retrieves authorized passages and supplies them to a foundation model through Amazon Bedrock. Chunk sizing and overlap belong to ingestion, while retrieval filtering, duplicate-context reduction, and prompt budgeting remain separate responsibilities. Document updates should trigger coordinated replacement of affected chunks and embeddings so answers use the intended source version.

Amazon Bedrock

Amazon Bedrock Knowledge Bases provides managed fixed-size chunking with a configured maximum token count and overlap percentage during ingestion. It connects segmentation with embedding and retrieval, while also offering other chunking approaches for different document structures.

Open Amazon Bedrock →
AWS Lambda image AWS Lambda

AWS Lambda can run custom splitting logic in an ingestion pipeline or supported Knowledge Bases transformation workflow. Use it when tokenization, boundary handling, or chunk metadata requires custom behavior, while respecting execution time, memory, and payload limits.

Open AWS Lambda →
Amazon Simple Storage Service image Amazon S3

Amazon S3 can store source documents and intermediate chunk artifacts for ingestion. Object identifiers and version information can be carried into chunk metadata to support provenance, reprocessing, and deletion workflows; S3 does not itself perform text chunking.

Open Amazon S3 →
Amazon OpenSearch Service image Amazon OpenSearch Service

Amazon OpenSearch Service can index chunk text, embeddings, and metadata for vector or hybrid retrieval. It consumes the chunks produced by ingestion rather than determining their boundaries, and supports filtering retrieved results using indexed metadata.

Open Amazon OpenSearch Service →