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 — Confirm the documents contain the answers users will ask for, since retrieval and prompt tuning cannot recover facts the corpus lacks
- A. The composition of the input corpus is the base that everything else depends on. If the knowledge users need is absent from the source documents, no chunking, retrieval tuning, re-ranking or prompt design can produce a correct answer. Checking coverage of the expected questions therefore comes before any downstream optimization.
- B. Adding more documents does not guarantee that the needed knowledge is present. It can add duplicate, outdated or irrelevant passages that compete with the right ones and lower retrieval precision. What decides quality is whether the included documents hold the answers users look for, not how many documents there are.
- C. Parsing quality matters, but RAG pipelines routinely ingest PDF, HTML, DOCX and other formats once each is extracted correctly into text. Limiting the corpus to one format would exclude valid sources and leave gaps in coverage, which is the more basic requirement. Format uniformity is a secondary convenience.
- D. Splitting long documents into chunks that fit retrieval and context limits is exactly what chunking strategies are for. A document's total length does not need to fit the context window, because only the retrieved chunks are passed to the model. Dropping long files would remove knowledge users may need and would not fix 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 corpus has no document covering how employees enroll in benefits, so the team should obtain that content and ingest it into the index
- A. Retrieval and chunking work well for other HR topics, yet one recurring category of questions finds nothing relevant at all. The most likely cause is that the knowledge base never contained material on that topic. Retrieval can only return what was ingested, so the fix is to obtain a benefits enrollment document and add it to the index.
- B. An embedding model's context window caps how much text of a chunk gets embedded. That depends on chunk length, not on subject matter, so it would affect any topic with chunks of similar size, and other topics retrieve well. A longer window and re-embedding would not create matches for content that was never ingested.
- C. Chunk overlap helps preserve context across boundaries in documents that are already ingested, and chunking is working well here. Poor boundaries would give incomplete or fragmented passages, not a consistent absence of relevant results for one category. More overlap cannot surface a document that was never ingested.
- D. Re-indexing frequency controls how soon changes in the source reach the index. A refresh lag would only delay new documents until the next sync, so it does not explain a category that consistently returns nothing. More frequent syncing also cannot add content that the source never held.
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 — Scan the scraped posts with classifiers for personal data and toxic language, and drop flagged content before indexing
- A. Running classifiers over the scraped posts during source preparation finds personal data and toxic language and removes it before indexing. The sensitive content never becomes a knowledge source, so it cannot be retrieved or repeated, which protects both quality and safety.
- B. Masking model responses leaves the raw personal data and offensive text in the corpus, where the retriever can still pull it into the model's context. A response-level guardrail is a last line of defense that can miss instances. The risk starts in the source data, so the content has to be cleaned before ingestion.
- C. Smaller chunks and a lower retrieval cap change retrieval granularity and volume, not what the corpus contains. The personal details and offensive language remain in the stored chunks and can still be retrieved and shown. Nothing is detected or removed before ingestion.
- D. A separate index with lower ranking only changes how often the forum posts surface. The unfiltered content is still a knowledge source and can still be retrieved when it matches a query. The personal details and offensive language are never detected or removed.
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