What you will be able to do
- Explain why the document corpus sets the upper limit on what a RAG application can answer
- Work backward from expected user questions to the documents the corpus must contain
- Diagnose a topic-specific retrieval failure as a coverage gap rather than a configuration problem
- Use domain experts to decide which sources are authoritative and what complete coverage means
- Test a candidate source against four criteria: relevant, current, unique, and clean
Key concept
The corpus as the ceiling on answer quality — A RAG application can only answer from what its corpus contains. Chunking, embeddings, re-ranking and prompting decide how well existing content is found and used, but none of them can supply knowledge that was never ingested.
1.The corpus sets the ceiling on answer quality
Choosing what goes into the corpus is the first decision in any RAG data pipeline, and it limits everything after it. The pipeline starts with corpus composition and ingestion: picking the data sources and content that fit the specific use case. Parsing, deduplication, filtering, chunking, embedding and indexing all come later, and they can only work on documents that were selected.
Retrieval quality has two ways to fail. The context passed to the LLM can be missing the information the user needs, or it can contain superfluous information that distracts the model. A missing document is the first kind of failure in its purest form. No retriever setting can return a passage that doesn't exist, and a generator with nothing relevant in its context will either refuse or hallucinate. Weak retrieval also drags down generation, so a gap in the corpus shows up later as a bad answer.
The goal is the right content, not the most content. Three tempting rules are all wrong. Bigger is better fails because duplicate and irrelevant documents actively hurt the index. One format only fails because a normal unstructured corpus mixes PDFs, Google and Office documents, and wikis, and the pipeline handles this by choosing a parser per type (for example, unstructured or PyPDF2 for PDFs and Word files, and BeautifulSoup for HTML). Exclude long documents fails because chunking exists to split large documents into smaller pieces that fit the LLM's context. Choosing the parser for each format is covered in extracting document content by format, and chunking in chunking strategy.
Checkpoint 1 of 7· Check yourself
A support assistant answers most product questions well. Its corpus was built from product manuals and FAQs, but the warranty policy document was never ingested. When users ask about warranty terms, the assistant refuses or makes up an answer. Which change will fix this?
The corpus sets the ceiling on answer quality. Retrieval settings, embeddings and re-ranking only change how existing content is found and ordered, and no setting can return a passage that was never ingested. The only fix is to add the missing source.
“Your RAG application can't retrieve the information required to answer a user query without the right data corpus.”Source: docs.databricks.com
Checkpoint 2 of 7· Exam question
Which statement best describes the foundational consideration when selecting source documents for a RAG application's corpus?
Correct answer: A — The corpus must actually contain the information users need, since no retrieval or generation technique can compensate for missing content
- A. Databricks guidance identifies the composition of the input data corpus as foundational: if the information users need is absent from the source documents, no amount of retrieval tuning, re-ranking, or prompt engineering can produce a correct answer. Coverage of the needed knowledge is the prerequisite that all downstream retrieval quality depends on.
- B. Simply maximizing document count does not guarantee relevant coverage and can introduce more duplicate, outdated, or irrelevant content that degrades retrieval quality. What matters is whether the included documents contain the knowledge users actually query for, not raw volume.
- C. RAG corpora routinely mix formats such as PDF, HTML, and DOCX, and format alone does not determine embedding accuracy as long as each format is parsed and extracted correctly. Restricting to one file format is unnecessary and would exclude valid knowledge sources.
- D. Long documents are precisely the case chunking strategies are designed to handle, splitting them into segments that fit within context and retrieval constraints. Excluding lengthy documents outright would discard potentially essential knowledge rather than solving a real limitation.
2.Working backward from the questions users will ask
The right corpus comes from the application's requirements, not from whatever data happens to be easy to reach. To find the needed sources, start from the questions users will ask and work back to the documents that answer them. For a customer support bot, that leads to four kinds of source, each covering a different kind of question.
| What users ask about | Source document that must be in the corpus |
|---|---|
| General how-to and policy questions | Knowledge base documents |
| Common, repeated questions | Frequently Asked Questions (FAQs) |
| What a product does and its exact specifications | Product manuals and specifications |
| Something is broken and needs fixing | Troubleshooting guides |
Sometimes the answer to a question isn't in a document at all. RAG can retrieve from structured data as well as unstructured data. Unstructured sources include PDFs, Office documents, wikis, images and videos. Structured sources include customer records in a warehouse, transaction data in a SQL database, and data from application APIs such as SAP or Salesforce. If users will ask "what is the status of my order?", the source you need is the transaction table, and no number of manuals will cover it.
How a failure is spread tells you where it comes from. Pipeline settings such as the parsing and chunking strategy, the embedding model, the number of chunks retrieved, and re-ranking all affect retrieval quality, but they apply the same way to every topic. If they were badly set, many topics would suffer. When one category of question returns nothing while the rest work, the likely cause is that the corpus has no document on that subject. Tuning settings won't help. The fix is to find the missing document and ingest it. To find gaps like this systematically, see evaluating retrieval performance.
Checkpoint 3 of 7· Match them up
Match each question users of a customer support assistant will ask to the source that has to be in the corpus to answer it.
Tap a term, then the definition that fits it.
To pick sources, start from the questions users will ask and work back to the source that answers each one. Fixing something broken calls for troubleshooting guides, exact specs for product manuals, and general how-to or policy questions for the knowledge base. Order status is per-customer structured data, so only the transaction table can answer it. No number of manuals will cover it.
“Your RAG application can't retrieve the information required to answer a user query without the right data corpus.”Source: docs.databricks.com
Checkpoint 4 of 7· Exam question
During evaluation of an HR-assistant RAG application, reviewers notice that a recurring category of employee questions about benefits enrollment consistently returns no relevant retrieved content, even though retrieval and chunking configurations are otherwise working well for other topics. What is the most likely root cause and appropriate fix?
Correct answer: A — The source corpus never included a benefits enrollment document, so the team should source and ingest that document to close the coverage gap
- A. When an entire topic returns no relevant content while other topics retrieve fine, the most likely explanation is that no document covering that topic was ever included in the source corpus, and the fix is to identify and add a benefits enrollment document. This reflects the core principle that retrieval quality is bounded by whether the corpus actually contains the needed knowledge.
- B. Embedding context window limits affect how much text a single chunk can represent, but they would degrade retrieval quality broadly rather than causing one specific topic to return nothing while others work normally. This does not explain a complete absence of relevant results for just one category.
- C. Chunk overlap affects whether context is preserved across chunk boundaries within existing documents, but it cannot produce results for a topic that has no corresponding source document at all. Adjusting overlap would not surface content that was never ingested.
- D. Update frequency determines how quickly changes to existing indexed documents are reflected in the vector index, but it does not explain a total absence of relevant matches for a topic if no benefits document exists to index in the first place.
3.Domain experts decide what complete coverage means
An engineer can list the document stores but usually can't say which version of a policy is the real one, or which questions come in every week. Subject-matter experts and stakeholders can. Bring them in at the start of the project, not after evaluation has already found gaps.
Experts contribute in three ways:
- Identifying and curating sources. They say which content is authoritative and which is outdated, a draft, or unofficial.
- Predicting queries. They know the kinds of questions users are likely to ask, which gives you the list of questions to work backward from.
- Prioritising. They rank the most critical information, so the first version of the corpus covers what matters most instead of whatever was easiest to ingest.
These decisions belong to experts because coverage and authority are questions about the domain, not about engineering. A support lead knows that the troubleshooting wiki is more current than the PDF manual. A benefits administrator knows that the intranet FAQ replaced last year's handbook. Neither fact shows up in file metadata. Feedback from experts after launch is covered in incorporating SME feedback.
Checkpoint 5 of 7· Check yourself
Your team is planning an HR benefits assistant and has not ingested anything yet. The benefits administrator has agreed to help. How should the team use their time to get the best corpus?
Coverage and authority are questions about the domain, so experts should take part from the start. They predict the questions to work backward from and say which sources are authoritative. Waiting for evaluation finds gaps late. Collecting whatever is easy to reach puts outdated and duplicate copies in the corpus, and the pipeline settings are engineering decisions.
“Engage domain experts and stakeholders from the beginning of any project to help identify and curate relevant content”Source: docs.databricks.com
Sources1
4.Four tests for a candidate source: relevant, current, unique, clean
A document that covers a needed topic isn't automatically fit for the corpus. Some ingested documents won't help the agent, because they are irrelevant to its purpose, too old or unreliable, or contain problematic content. Others contain sensitive information that must never be exposed through the agent. Together with duplication, these give four tests that each candidate source has to pass.
| Criterion | Failure if ignored | How to enforce it |
|---|---|---|
| Relevant | Off-purpose documents add superfluous context that crowds out useful chunks | Filter out documents irrelevant to the agent's purpose |
| Current | Old or unreliable documents give stale answers, which defeats RAG's up-to-date advantage | Drop outdated versions; when copies conflict, keep the most recently updated |
| Unique | Duplicates and near-duplicates fill the index with redundant chunks | Deduplicate by metadata or content; keep the most authoritative copy |
| Clean | Personal information or harmful language can reach users through answers | Apply a toxicity classifier and PII detection, and filter before ingestion |
Current matters because freshness is one of the reasons to use RAG in the first place: the application can give the LLM information from an updated knowledge base. A corpus full of superseded manuals throws that advantage away.
Unique is mostly a problem of shared drives. The same document often sits in several folders with small edits, alongside draft blog posts and copies of product docs. Deduplicating by picking any copy at random is only a baseline. It is better to keep the best version: the most recently updated, the published one, or the one from the most authoritative source. Choosing the authoritative copy is the same judgement domain experts make when they curate sources.
Clean is about whether a source is safe to include, and that has to be checked before the document is added. Suppose a team supplements an internal wiki with scraped public posts that include email addresses and abusive replies. The fix is to run the documents through a toxicity classifier and a PII detection algorithm, then use the predictions as a filter before ingestion. Filtering comes before chunking in the pipeline, so smaller chunks only spread the sensitive text across more pieces. Moving the posts to a separate table leaves them retrievable. Relying on guardrails at inference time leaves the content in the corpus and hopes the model never repeats it. Sources are also a route for data poisoning attacks, which is another reason to detect and filter at this stage.
These four tests decide whether a whole document goes into the corpus. Removing boilerplate from inside documents you keep is covered in filtering extraneous content. Masking or rewriting problematic passages is covered in mitigating problematic text, and checking whether you're allowed to use a source at all is covered in legal and licensing requirements.
Checkpoint 6 of 7· Match them up
An IT helpdesk team reviews candidate sources before ingestion. Match each problem they find to the source quality test it fails.
Tap a term, then the definition that fits it.
Off-purpose content fails Relevant because it adds superfluous context. Superseded versions fail Current because they give stale answers. Near-identical copies fail Unique because they fill the index with redundant chunks. Personal data and harmful language fail Clean, so those documents must be detected and filtered out before ingestion.
“either because they are irrelevant to its purpose, too old or unreliable, or because they contain problematic content such as harmful language”Source: docs.databricks.com
Checkpoint 7 of 7· Exam question
A team is preparing a source corpus by scraping publicly available community forum posts to supplement an internal knowledge base for a RAG assistant. Some forum posts contain personal contact details and occasional offensive language. Before these documents are added as knowledge sources, what should the team do to protect application quality and safety?
Correct answer: A — Run the scraped documents through classifiers to detect and filter out personal information and harmful language before ingestion
- A. Applying classifiers to detect personal information and harmful language during source preparation directly prevents sensitive or offensive content from entering the corpus at all. This matches the guidance that sensitive information and harmful language in source documents should be filtered using classifiers before ingestion.
- B. Relying on inference-time guardrails does not stop the retriever from surfacing the sensitive content as retrieved context, and the guardrail could still fail to catch every instance. The underlying risk originates in the source data, so filtering needs to happen during preparation rather than after retrieval.
- C. Splitting sensitive text across smaller chunks does not remove personal information or offensive language from the corpus; the content is still present and retrievable, just fragmented. Chunk size affects retrieval granularity, not content safety.
- D. Placing the forum posts in a separate table that is queried less often reduces but does not eliminate the chance that sensitive or harmful content is retrieved and surfaced to users. The unfiltered content remains available as a knowledge source.
Sources
(3)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/quality-data-pipeline-ragOfficial docs
“Corpus composition and ingestion: Select the right data sources and content based on the specific use case.”
↩︎ The corpus sets the ceiling on answer quality“Segmenting large documents into smaller, semantically concentrated chunks ensures that retrieved data fits in the LLM's context”
↩︎ The corpus sets the ceiling on answer quality“The correct data depends entirely on your application's specific requirements and goals”
↩︎ Working backward from the questions users will ask“Engage domain experts and stakeholders from the beginning of any project to help identify and curate relevant content”
↩︎ Domain experts decide what complete coverage means“insights into the types of queries that users are likely to submit and help prioritize the most critical information to include.”
↩︎ Domain experts decide what complete coverage means“either because they are irrelevant to its purpose, too old or unreliable, or because they contain problematic content such as harmful language.”
↩︎ Four tests for a candidate source: relevant, current, unique, clean“select the “best” version of the duplicate using other logic (such as most recently updated, publication status, or most authoritative source)”
↩︎ Four tests for a candidate source: relevant, current, unique, clean“applying a personally identifiable information (PII) detection algorithm to the documents to filter documents.”
↩︎ Four tests for a candidate source: relevant, current, unique, clean“any document sources you feed into your agent are potential attack vectors for bad actors to launch data poisoning attacks.”
↩︎ Four tests for a candidate source: relevant, current, unique, clean“removing duplicates, and filtering out unwanted information, the next step is to break it down into smaller, manageable units called chunks.”
↩︎ Four tests for a candidate source: relevant, current, unique, clean“Your RAG application can't retrieve the information required to answer a user query without the right data corpus.”
↩︎ Key concept“you can end up with highly redundant chunks in your final index that can decrease the performance of your application.”
↩︎ Exam trap 1“Your RAG application can't retrieve the information required to answer a user query without the right data corpus.”
↩︎ Exam trap 2“applying a toxicity classifier to the document to produce a prediction you can use as a filter.”
↩︎ Exam trap 3“Engage domain experts and stakeholders from the beginning of any project to help identify and curate relevant content”
↩︎ Exam trap 4“you can end up with highly redundant chunks in your final index that can decrease the performance of your application.”
↩︎ Prediction“Your RAG application can't retrieve the information required to answer a user query without the right data corpus.”
↩︎ Checkpoint“Your RAG application can't retrieve the information required to answer a user query without the right data corpus.”
↩︎ Prediction“either because they are irrelevant to its purpose, too old or unreliable, or because they contain problematic content such as harmful language”
↩︎ Checkpoint - 2.
“It's difficult to generate high-quality RAG output if the context provided to the LLM is missing important information or contains superfluous information.”
↩︎ The corpus sets the ceiling on answer quality“generation quality will invariably be impacted by poor retrieval”
↩︎ The corpus sets the ceiling on answer quality“Retrieval quality can be influenced by both the data pipeline (for example, parsing/chunking strategy, metadata strategy, embedding model)”
↩︎ Working backward from the questions users will ask - 3.
“RAG architecture can work with either unstructured or structured supporting data. The data you use with RAG depends on your use case.”
↩︎ Working backward from the questions users will ask“Up-to-date information: A RAG application can supply the LLM with information from an updated knowledge base.”
↩︎ Four tests for a candidate source: relevant, current, unique, clean