Parsing and Chunking
Choose a parsing strategy and a chunking strategy for the documents of a MariaDB Cloud AI Retrieval knowledge base, and set the chunk size and overlap.
When AI Retrieval ingests a document, it first parses the file to extract its text, and then splits the text into chunks. AI Retrieval creates an embedding for each chunk and stores it in the vector store. A retrieval request returns chunks, so how a document is parsed and chunked decides which passages a question can find.
You choose a parsing strategy and a chunking strategy in the Processing step when you upload files, and again when you add a data source. The defaults are Layout-aware parsing and Structure-aware chunking.

Choose a Parsing Strategy
Layout-aware (default)
Extracts the layout and the text of complex digital documents, where the meaning depends on the structure.
PDF, DOCX, PPTX, and static HTML files with headings, tables, lists, or several columns.
Basic
Extracts plain text only.
TXT, Markdown, and JSON files, and digital DOCX or PDF files that contain linear prose.
Both strategies read digital documents only. Scanned documents, which are PDFs that contain only images of pages, are not supported yet. Layout-aware parsing uses OCR to detect the layout of a page, not to read scanned pages.
Which strategy to choose:
Keep Layout-aware when a document has tables, a heading structure, or a page layout that carries meaning. Use it with the Structure-aware chunking strategy, which relies on the document structure that Layout-aware parsing extracts.
Choose Basic for files that are plain text already. It does not add anything for a text or Markdown file.
Choose a Chunking Strategy
Structure-aware (default)
Follows the structure of the document. Keeps tables, code blocks, and formulas as their own chunks and keeps the section context of each chunk.
None.
Fixed-sized
Splits the text into chunks of the token size that you set.
Chunk size, chunk overlap
Sentence-based
Splits the text at sentence boundaries, so each sentence stays whole within a chunk.
Chunk size, chunk overlap
Recursive
Splits along paragraphs first, then sentences, then words. Keeps larger units intact until the size limit is reached.
Chunk size
Semantic
Groups sentences into chunks by meaning, so related content stays together.
Chunk size

Which strategy to choose:
Start with Structure-aware. It needs no tuning, and tables and code stay in one piece.
Choose Recursive for prose that is organized in paragraphs, such as articles and manuals, when you want a size limit that you control.
Choose Sentence-based when a chunk should never end in the middle of a sentence.
Choose Fixed-sized when you need chunks of a predictable size.
Choose Semantic when a document changes topic without clear headings.
Set the Chunk Size and Overlap
Every strategy except Structure-aware shows a Chunk size (tokens) field. Fixed-sized and Sentence-based also show a Chunk overlap (tokens) field.

Chunk size
350 tokens
At least 128 tokens. Cohere embedding models accept at most 350 tokens.
Chunk overlap
100 tokens
Smaller than the chunk size.
Guidance:
A small chunk matches a question more precisely but carries less context. A large chunk carries more context but can mix several topics, which makes it match less precisely.
The overlap repeats the end of one chunk at the start of the next. A larger overlap keeps a sentence that falls on a boundary readable in both chunks, but it creates more chunks to store and to embed.
Chunk size has no upper limit other than the limit of the embedding model.
When the reranker is on, it reads only the first 512 tokens of each chunk and ignores the rest, so a larger chunk is ranked on its beginning only. Keep the chunk size at 512 tokens or below when you use the reranker.
Next Steps
Document Knowledge BasesThis page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

