RAG Pipelines, Chunking, and AI Search
Databricks Context Engineer Associate · Lesson 7 of 18 · 47:35
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Databricks Certified Context Engineer Associate exam. In this lesson: a RAG pipeline from a Unity Catalog volume to a Delta table and an AI Search index, chunking strategies and overlap, sizing chunks within the embedding model's limit, parent-child chunks, and tracing bad retrieval to sync, hybrid search, filters, or reranking. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Forty buildings of rules
Thistledown keeps house rules and lease templates for forty buildings, as PDF files in a Unity Catalog volume. The support agent retrieves rules from the wrong building, and misses clauses that tenants quote by their code. This lesson builds a RAG pipeline from that volume, chooses how to chunk the documents, and traces bad retrieval back to its cause in AI Search.
From volume to context
A RAG pipeline on Databricks starts with documents in a Unity Catalog volume, so access to the source is governed from the start. A parsing step pulls out the text and structure, for example with the AI parse document function, and a chunking step splits it into passages. Each chunk becomes a row of a managed Delta table, with a unique ID, the text, and metadata like the document, the building, and the section, and change data feed is turned on. An AI Search index, formerly Vector Search, then syncs from that table, with embeddings computed by Databricks or by you. At inference time, the agent queries the index, and the best chunks enter its context, with their source, so the answer can cite it.
Chunking strategies
Fixed size chunking cuts the text every few hundred tokens, which is simple, but often splits a sentence or a rule in two. Recursive chunking splits on paragraphs first, then on sentences, so chunks follow the natural breaks of the text. Structure aware chunking follows the document's own headings, like numbered sections of house rules, or sections of an HTML page. And semantic chunking starts a new chunk where the topic changes, at a higher processing cost.
Sizing chunks
Smaller chunks locate precise facts, while larger chunks carry more surrounding context, so common starting points are two hundred fifty six, five hundred twelve, or a thousand twenty four tokens. A chunk must fit the input limit of the embedding model, otherwise the text is truncated before it is embedded, and its end is never searchable. Overlap between neighboring chunks keeps meaning that crosses a boundary. The parent child pattern searches small chunks for precision, then gives the model the larger parent passage for context. And adding the document title and section to each chunk helps both search and citation.
When retrieval goes wrong
Most retrieval problems trace back to one setting. Stale answers often mean a Delta Sync index in triggered mode that nobody synced after the table changed, while continuous mode stays current at a higher cost. Exact codes or names that vector search misses call for hybrid search, which combines keyword and vector matching. Results from the wrong building call for a metadata filter, and the right passage ranked too low calls for the reranker. And answers that ignore the end of long passages point to chunks larger than the embedding model's limit.
Recap
Let's recap. A RAG pipeline goes from a governed volume, through parsing and chunking, to a Delta table and an AI Search index. Each chunk carries an ID, its text, and metadata for filters and citations. Choose chunking from the document's structure, and size chunks within the embedding model's limit. Overlap, parent child chunks, and titles in chunks preserve context. And trace bad retrieval to its setting: sync, hybrid search, filters, reranking, or chunk size.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
The support agent must cite the clause and the building behind every answer. What should each row of the chunk table carry?
- Only the embedding vector of the chunk
- A unique ID, the text, and document, building, section
- The whole PDF file as a binary column
- Only the chunk text, without IDs
Show the answer
A unique ID, the text, and document, building, section
A unique ID, the chunk text, and metadata such as the document, building, and section, which allow filters and citations. “Only the embedding vector of the chunk” is wrong, since an embedding alone gives the agent nothing to read or to cite. “The whole PDF file as a binary column” is wrong, since a whole PDF file cannot be searched passage by passage. And “Only the chunk text, without IDs” is wrong, since without IDs and metadata, the index cannot sync rows, and the agent cannot cite a source.
House rules are numbered sections of 100 to 300 words under clear headings, and each question targets one rule. Which chunking strategy fits?
- Fixed chunks of 2,000 tokens
- One chunk per whole document
- One chunk per sentence
- Structure-aware chunks on the section headings
Show the answer
Structure-aware chunks on the section headings
Structure aware chunking on the section headings keeps one complete rule in each chunk. “Fixed chunks of 2,000 tokens” is wrong, since two thousand token chunks would mix many rules, and blur the match. “One chunk per whole document” is wrong, since one chunk per document would make every rule compete with the whole file. And “One chunk per sentence” is wrong, since single sentences would cut rules apart, and lose their conditions.
Tenants quote clauses by code, like R-12, but the index returns clauses that sound similar, and rarely R-12 itself. Which change fixes this most directly?
- Switch the query to hybrid search
- Make the chunks larger
- Return more results per query
- Move the index to continuous sync
Show the answer
Switch the query to hybrid search
Hybrid search adds keyword matching, so an exact code like R twelve is found. “Make the chunks larger” is wrong, since larger chunks make each match less precise, and do not help with codes. “Return more results per query” is wrong, since returning more results still ranks the exact code poorly. And “Move the index to continuous sync” is wrong, since continuous sync fixes stale data, not how codes are matched.