BuildSpark AI

Map · Retrieval & Grounding · 02 · Chunking

Concept card · Retrieval & Grounding

Chunking

Chunking splits a document into pieces that retrieval can store and return.

Splitting documents into pieces that retrieval can store and return.

Last checked 2026-10-17 Free card 4 min

Ask about Chunking

What changed

Oct 17: First card. The picture cuts one note two ways. Sources are the OpenAI retrieval guide, the Gemini File Search guide, and LangChain's text splitter guide.

1 What it is

Chunking splits a document into pieces small enough to store and return. LangChain's text splitter guide says those pieces should be retrievable on their own and fit in a context window. OpenAI's retrieval guide says a file added to a vector store is chunked, embedded, and indexed. Gemini's File Search guide says an imported file is broken into chunks, then embedded.

Illustration. One short note, cut two ways. A provider splitter can count tokens and keep an overlap. This picture does not.

2 Why it matters

Cost

Each stored piece can be embedded and kept. Overlap repeats text across pieces, so the same sentence can be stored more than once. OpenAI's retrieval guide documents a default of 800-token chunks with 400 tokens of overlap, and a chunk size from 100 to 4096 tokens. Those are that API's settings, not a universal size.

Quality

LangChain's text splitter guide says splitters break large documents into smaller chunks that can be retrieved on their own and that fit in a context window. A piece that starts mid-sentence can be returned without the heading it needed.

Risk

OpenAI's retrieval guide says files added to a vector store are chunked automatically unless you set a chunking strategy. A default cut can separate a fact from the name it refers to. Gemini's File Search guide also chunks on import, and documents a config for a maximum number of tokens per chunk and an overlap.

3 How to apply · try today

Take one page you would search. Mark the cuts so each piece still names the thing it is about. If a sentence uses "it" or "the company," keep the name in that piece.

Common mistake

Cutting on a fixed length so a heading, a sentence, or a table row is split, then retrieving the half that does not say what it refers to.

Self-check

A sentence says "It closes at 18:00." The heading "Warehouse hours" is in the previous piece. What is wrong with that cut?

Questions

What is chunking?
Chunking splits a document into pieces that retrieval can store and return.
Does every API use the same chunk size?
No. OpenAI's retrieval guide documents a default of 800-token chunks with 400 tokens of overlap, and a size you can set from 100 to 4096 tokens. Gemini's File Search guide documents a chunking config for a maximum number of tokens per chunk and an overlap. Those are settings on those APIs.
What goes wrong if a piece starts mid-sentence?
Retrieval can return that piece without the heading or the name the sentence needed.