Which chunking method suits which kind of document.
From Ultra Transcenders DBX-GENAI by Tony Rough (coming December 2026)
Databricks states that there is no one-size-fits-all approach: the right method is iterative and depends on the use case and the data. The structure already in the document is the best first guide.
| Method | Where boundaries come from | Named tool on the Databricks page | Fits | Breaks when |
|---|---|---|---|---|
| Fixed-size | A set number of characters or tokens | LangChain CharacterTextSplitter |
Quick baselines and a hard guard against a token limit | Boundaries fall mid-thought; Databricks says it rarely works for production-grade applications |
| Paragraph-based | Natural paragraph breaks | LangChain RecursiveCharacterTextSplitter |
Prose where a paragraph holds one idea | Paragraph lengths vary widely, or a single idea runs across several paragraphs |
| Format-specific | Markup such as Markdown or HTML headers | LangChain MarkdownHeaderTextSplitter, HTML header or section splitters |
Documentation, wikis, web pages | Source has lost its structure during parsing |
| Semantic | Topic shifts or similarity between sentences | LangChain SemanticChunker |
Long content with no reliable markup | More effort to build and run than the basic approaches |
Some decision rules follow from that table:
ai_parse_document function is the Databricks recommendation for PDFs and complex documents.A token-counted split is still useful as a safety net beneath a structural method, or for a first baseline. The Databricks example notebook uses this pattern with tiktoken, here with a smaller limit than the notebook’s 8192:
import tiktoken
max_chunk_tokens = 512
encoding = tiktoken.get_encoding("cl100k_base")
def chunk_text(text):
tokens = encoding.encode(text)
chunks = []
while tokens:
chunk_tokens = tokens[:max_chunk_tokens]
chunks.append(encoding.decode(chunk_tokens))
tokens = tokens[max_chunk_tokens:]
return chunksThis loop has no overlap and no regard for sentences, so it is a guard rather than a finished strategy. It also needs a new unique chunk ID for each piece: the same notebook builds one from the source ID and a counter, as in f"{row['id']}_{chunk_no}".
Common trap: Reading “recursive” splitters as a form of semantic chunking - the Databricks page lists
RecursiveCharacterTextSplitterunder paragraph-based chunking, and its fixed-size example also uses that class withchunk_size=100andchunk_overlap=20. The page groups it with LangChain’s character splitters, whileSemanticChunkeris its semantic example.
This note is one section of Ultra Transcenders DBX-GENAI: Databricks Generative AI Engineer Associate, an independent study guide that explains every topic the exam covers by technology, with comparison tables, diagrams and the common traps, plus a glossary linked to the Databricks documentation.
Due on Amazon in December 2026, in Kindle and paperback editions.
About the book · DBX-GENAI terms in the glossary · All DBX-GENAI study notes
What decides between the two endpoint types for an index.
What a reranker adds to retrieval, and what it costs.
How to choose a framework for a generative AI application.
What signatures and input examples do when logging a model.
Which workloads suit ai_query(), and how to run them.
The built-in judges that need expected answers, and those that don't.
How the evaluation and monitoring phases of a generative AI application differ.