Repository navigation
Module 3.2 Addendum
These reading guides accompany the assigned sources for each chapter of Module 3. Work through the guiding questions as you read — they focus your attention on the concepts the chapter lessons, labs, and quizzes will assess. Complete the extraction tasks embedded in each guide before moving to the next chapter.
Sources covered:
- Lewis, P., et al. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. NeurIPS 2020. (Abstract + Sections 1–2)
- Bommasani, R., et al. (2021). On the opportunities and risks of foundation models. arXiv:2108.07258. (Section 2.1 only)
- Video 1: "What is Retrieval-Augmented Generation (RAG)?" — IBM Technology (~6 min)
Estimated study time: ~12 minutes (Lewis et al.) + ~8 minutes (Bommasani et al. Section 2.1) + ~6 minutes (video)
Chapter connection: These sources establish the foundational distinction that motivates every subsequent topic in Module 3. Read them in order: Bommasani et al. first for the theoretical framing, then Lewis et al. for the architectural solution, then the video as a synthesis check.
Bommasani et al. (2021) articulate the fundamental constraint of foundation models: the knowledge encoded in model parameters during training is static — it cannot be updated without retraining, cannot be attributed to specific sources, and cannot incorporate information that postdates the training cutoff. This constraint is not incidental; it is structural, arising from how gradient-descent-based training encodes information into billions of parameter weights. Lewis et al. (2020) introduced Retrieval-Augmented Generation (RAG) as a principled architectural solution: by coupling a parametric generative model with a non-parametric retrieval index, the system can ground its generation in dynamically retrieved, externally verifiable, and continuously updatable evidence.
This distinction — parametric vs. non-parametric memory — is the conceptual backbone of Module 3. Every subsequent design decision (pipeline stage, memory type, chunking strategy, retrieval method) is an engineering response to the fundamental properties and limitations of each memory class.
| Term | Working Definition |
|---|---|
| Parametric memory | Knowledge encoded in model weights during training; fixed at training time, inaccessible to external inspection or update without retraining |
| Non-parametric memory | Knowledge stored in an external index or database; retrievable at inference time, updatable without model retraining, attributable to specific source documents |
| Foundation model | A large model trained on broad data that can be adapted to a wide range of downstream tasks (Bommasani et al., 2021) |
| Training cutoff | The date beyond which a model's parametric knowledge does not extend; information published after this date is not in the model's weights |
| Knowledge-intensive NLP task | A task (question answering, fact verification, document-grounded dialogue) whose correct completion requires access to specific factual knowledge that may not be reliably encoded in parametric memory |
| Hallucination | A generated output that is fluent and plausible but factually incorrect or unsupported by the retrieved context — a characteristic failure mode of parametric-only generation |
| RAG | Retrieval-Augmented Generation — an architecture that combines a parametric generative model with a non-parametric retrieval component, grounding generation in retrieved evidence |
| Retrieval index | The external data structure (typically a vector store) that stores document representations and supports semantic similarity search at inference time |
| Inference time | The moment when a trained model processes an input and generates an output — distinct from training time, when model weights are updated |
| Grounding | Constraining a generative model's output to be consistent with and attributable to specific retrieved source documents |
Section A — Bommasani et al. (2021): Section 2.1 — Parametric vs. Non-Parametric Knowledge
-
Bommasani et al. distinguish parametric knowledge (encoded in model weights) from non-parametric knowledge (stored externally). What is the precise technical meaning of "encoded in weights"? Why does this encoding mechanism make parametric knowledge difficult to inspect, attribute, or update?
-
The report characterizes foundation model capabilities as "emergent" from scale. What does this imply about the relationship between a model's training data distribution and its parametric knowledge? What categories of knowledge are most likely to be reliably encoded, and which are most likely to be unreliably encoded or absent?
-
Bommasani et al. identify the "long tail" of specialized knowledge as a particular limitation of parametric memory. In a professional deployment context — healthcare, law, finance, education — give two specific examples of long-tail knowledge that would be essential for a high-quality agent but is unlikely to be reliably encoded in a general-purpose foundation model's parameters.
-
What organizational property makes non-parametric memory especially valuable in enterprise AI deployment? Specifically, what would it take to update a parametric model when an organization's internal policy changes, and how does RAG eliminate that cost?
Section B — Lewis et al. (2020): Abstract + Sections 1–2
-
Lewis et al. define RAG formally as a combination of two components. Name both components precisely and describe what each contributes to the system's overall capability.
-
The paper identifies "knowledge-intensive NLP tasks" as the target problem class for RAG. What properties make a task "knowledge-intensive"? Give one example of a task that qualifies and one that does not, with a justification for each.
-
Lewis et al. describe RAG as a model that "jointly reasons over parametric and non-parametric memory." What does "jointly" mean in this context? Why is joint reasoning more powerful than either component alone?
-
The original RAG architecture uses a dense passage retriever (DPR) for the retrieval component. What is the functional role of the retriever in the system, and what property of the query-document relationship does it exploit to find relevant passages?
-
Lewis et al. contrast RAG with parametric-only models and with "retrieve-then-read" pipelines. What distinguishes RAG from a simple retrieve-then-read approach? What does the "augmented generation" component add that simple retrieval does not provide?
Section C — IBM Technology Video: "What is RAG?"
-
After watching the video, identify one concept from Lewis et al. that the video explains accurately and one that it simplifies in a potentially misleading way. Justify your assessment with reference to the original paper.
-
The video uses an analogy to explain RAG to a non-technical audience. Evaluate the analogy: what does it capture well about the parametric/non-parametric distinction, and what does it fail to convey about the engineering complexity of the retrieval component?
-
A colleague argues: "Since LLMs will eventually be retrained more frequently, the parametric/non-parametric distinction will become less important." Evaluate this claim using the concepts from Bommasani et al. What categories of knowledge would remain non-parametric even with daily retraining?
-
The shift from parametric-only to RAG-augmented generation introduces a new failure mode: retrieval failure (the system retrieves irrelevant or no relevant documents). How does this failure mode differ from hallucination in parametric-only systems? What new evaluation responsibilities does it place on the practitioner?
Reading Guide 2 — Chapter 2: The Six-Stage RAG Pipeline — Architecture, Design Decisions, and Downstream Consequences
Sources covered:
- Lewis, P., et al. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. NeurIPS 2020. (Re-read: focus on the two-component architecture)
- Gao, Y., et al. (2023). Retrieval-augmented generation for large language models: A survey. arXiv:2312.10997. (Sections 1–3)
- LangChain Documentation: Document Loaders, Text Splitters, Vector Stores, RetrievalQA
- Video 2: "RAG Explained For Beginners" — KodeKloud (~10 min)
Estimated study time: ~15 minutes (Gao et al. Sections 1–3) + ~15 minutes (LangChain docs) + ~10 minutes (video)
Chapter connection: Gao et al. (2023) is the most comprehensive survey of the RAG literature and directly grounds the six-stage pipeline the labs implement. The LangChain documentation provides the component-level implementation vocabulary. Read Gao et al. first; use the LangChain documentation as a reference while completing the pipeline diagram template.
Gao et al. (2023) identify three evolutionary RAG paradigms — Naive RAG, Advanced RAG, and Modular RAG — that represent increasing sophistication in pipeline design. However, all three share six functional stages: document ingestion, text splitting (chunking), embedding generation, vector indexing, retrieval, and augmented generation. Understanding these stages at the level of their data flow (what format the data enters and exits each stage) and the design decisions made at each stage is the prerequisite for diagnosing failures, selecting optimization strategies, and evaluating system quality. The LangChain component names that implement each stage provide the engineering vocabulary for the labs.
| Term | Working Definition |
|---|---|
| Document ingestion | Stage 1: Loading raw source documents into the pipeline using a document loader (e.g., PyPDFLoader); output is a list of Document objects with content and metadata |
| Text splitting (chunking) | Stage 2: Dividing loaded documents into smaller units (chunks) suitable for embedding and retrieval; output is a list of smaller Document objects |
| Embedding generation | Stage 3: Converting text chunks into dense numerical vectors using an embedding model; output is a list of fixed-dimension float vectors |
| Vector indexing | Stage 4: Storing chunk embeddings in a searchable vector database (e.g., Chroma, FAISS); enables fast semantic similarity search at retrieval time |
| Retrieval | Stage 5: Given a query embedding, finding the k most similar chunk embeddings in the vector store; output is a list of k retrieved Document chunks |
| Augmented generation | Stage 6: Combining the retrieved chunks with the user query into an augmented prompt and passing it to the LLM; output is a generated answer grounded in the retrieved context |
| Naive RAG | The baseline RAG paradigm: sequential, one-pass retrieval and generation with no iterative refinement or query transformation |
| Advanced RAG | An extended paradigm adding pre-retrieval (query transformation, routing) and post-retrieval (re-ranking, compression) processing to improve precision |
| Modular RAG | The most flexible paradigm: arbitrary composition of specialized retrieval, processing, and generation modules into non-sequential pipelines |
| chunk_overlap | A parameter in text splitting that specifies the number of characters shared between adjacent chunks, preserving context across chunk boundaries |
Section A — Gao et al. (2023): Sections 1–3 — RAG Framework and Pipeline
-
Gao et al. enumerate six stages of the RAG pipeline. List all six in order and describe the data format at the input and output of each stage (e.g., "Stage 2 input: Document objects with raw text; output: smaller Document objects (chunks)"). This data-flow specification is the basis for diagnosing at which stage a pipeline failure originates.
-
The survey distinguishes three RAG paradigms: Naive, Advanced, and Modular. What specific limitations of Naive RAG motivated the development of Advanced RAG? Name at least two concrete failure modes of Naive RAG that Advanced RAG addresses.
-
Gao et al. identify two main retrieval quality dimensions: context precision and context recall. Explain the tension between them. Under what corpus and query conditions would you sacrifice context recall to maximize context precision, and under what conditions would you do the reverse?
-
The survey notes that chunking is "the most consequential single decision in RAG pipeline design." Why does chunking occur before embedding rather than after? What property of embedding models makes it necessary to split documents before encoding them?
-
Gao et al. describe Modular RAG as enabling "arbitrary composition" of modules. What does this flexibility cost in terms of system design complexity and debugging difficulty? Under what organizational conditions is Modular RAG's flexibility worth that cost?
Section B — LangChain Documentation: Pipeline Components
-
The LangChain documentation describes PyPDFLoader as a document loader that preserves page-level metadata. Why is metadata preservation at the ingestion stage important for later retrieval optimization (specifically, metadata filtering at Stage 5)?
-
RecursiveCharacterTextSplitter uses a priority list of separators (paragraph breaks, sentence breaks, word breaks) to find split points. What problem does this recursive strategy solve compared to a simple fixed-character-length splitter? What type of document content benefits most from recursive splitting?
-
The lab's retrieval tool returns each passage with its source and page. Why is this information essential for diagnosing faithfulness failures?
-
The vector store's
as_retriever(search_kwargs={'k': 4})call configures Stage 5 retrieval. What is the effect of increasing k from 4 to 8 on (a) context recall, (b) context precision, and (c) total input tokens to the generation stage?
Section C — KodeKloud Video: "RAG Explained For Beginners"
- The video presents the six pipeline stages with visual diagrams. After watching, complete your pipeline diagram template with: the stage name, the data format in/out, and the LangChain component name for each of the six stages. If any stage is missing from your template after the video, return to the Gao et al. survey and fill the gap before proceeding.
-
Lewis et al.'s original RAG architecture used a single retrieval pass. What does the existence of Advanced RAG's query transformation techniques (e.g., HyDE — Hypothetical Document Embeddings, multi-query retrieval) tell us about the limitations of single-pass retrieval? What specific properties of user queries make them poor inputs for direct embedding-based retrieval?
-
The six-stage pipeline treats document ingestion as a one-time offline process and retrieval as an online, per-query process. What organizational workflows would require ingestion to be a continuous, streaming process rather than a batch process? What engineering challenges does continuous ingestion introduce that batch ingestion does not?
Assigned:
- LangChain Documentation
checkpointerandmiddleware— In LangChain, acheckpointeris required when using certain middleware (such as HumanInTheLoopMiddleware) because the agent needs a persistent state saver to resume execution after a paused state or an interrupt. - Memory Conceptual Guide
- LangChain Tutorials — Lesson 8: Memory & Context Management
Estimated time: ~40 minutes
By the end of this chapter you should be able to:
- Explain why LLMs need an explicit memory mechanism for multi-turn conversations.
- Describe how
RunnableWithMessageHistoryconnects a chain to a history store. - Compare the four memory patterns (Buffer, Window, Summary, Hybrid) on token cost and fidelity.
- Select the appropriate memory pattern for a deployment scenario given cost and fidelity constraints.
- Explain how agent state in
create_agentextends to multi-agent systems in Module 4.
LLMs are stateless: each API call receives only the tokens in the current prompt. Without an explicit memory mechanism, every conversation turn starts from scratch. Memory solves this by deciding what prior context to include in the prompt and how to represent it.
LangChain's memory system has three components:
- A prompt template with a history slot — reserves space where prior messages are inserted.
-
A chain (
prompt | llm) — the processing pipeline. -
RunnableWithMessageHistorywrapper — connects the chain to a history store, automatically loading prior messages before each call and saving new messages after.
Each conversation gets a unique session_id, so one chain can serve many concurrent conversations without mixing histories.
Each pattern trades off token cost against context fidelity:
Buffer
- Stores every message verbatim.
- Token cost grows linearly with each turn.
- Best for: short conversations (<10 turns) where complete fidelity matters (e.g., medical record review, compliance dialogue).
Window
- Keeps only the last k turns; drops older messages.
- Token cost is stable once the window is full.
- Best for: customer support, coding assistants — where recent context matters most and early turns can be dropped.
Summary
- Uses an LLM to compress older messages into a running summary; keeps recent messages verbatim.
- Token cost is low and stable.
- Risk: semantic drift — specific details (names, numbers, exact phrasing) may not survive summarization.
- Best for: extended multi-session discussions where key decisions must persist but exact wording doesn't.
Hybrid (Summary + Buffer)
- Rolling summary of older turns + verbatim buffer of recent turns.
- Token cost is low to moderate.
- Best for: long, dense conversations (debugging, iterative drafting) needing both recency and long-range context.
- Recommended default for production single-agent applications.
| Pattern | Storage | Token Cost | Best Use Case |
|---|---|---|---|
| Buffer | Verbatim transcript | Linear (unbounded) | Short sessions, maximum fidelity required |
| Window | Last k turns only | Stable (bounded by k) | Recent context sufficient, older turns dispensable |
| Summary | LLM-generated summary | ~Constant | Long sessions, cost-constrained, general context sufficient |
| Hybrid | Summary + recent buffer | Low–moderate | Long dense sessions needing recency + long-range context |
The four patterns above are ephemeral — history is lost when the process stops. For production, configure a persistent backend (database, file store) so conversation history survives across sessions. The RunnableWithMessageHistory wrapper supports pluggable backends for this purpose.
For multi-agent systems (Module 4), LangGraph manages state as a typed, structured graph node rather than a message history. Key advantages:
- Explicit: All memory fields are declared in the schema — no implicit state.
- Testable: Unit tests can assert on state after each node execution.
- Auditable: Full state at each step can be logged and reviewed.
For single-agent applications, RunnableWithMessageHistory is sufficient. For multi-agent coordination, LangGraph's structured state is preferred.
Complete these before proceeding to the quiz.
Task A — Reconstruct the Reference Table Close this guide and reconstruct the four-row pattern table from memory. Check against Section 4. Any cell you cannot fill is a gap to address.
Task B — Token Cost Sketch For Buffer and Summary: sketch the token-count curve (y-axis: tokens in context; x-axis: turn number) for a 20-turn conversation. Label the shape of each curve (linear vs. bounded).
Task C — Scenario Classification For each scenario, identify the best memory pattern and write a one-sentence justification:
- A legal assistant that must recall exact clause language from turn 3 in a 7-turn session.
- A customer support bot handling 10,000 simultaneous sessions of ~15 turns each.
- A debugging assistant with 40+ turn sessions where the user references decisions from 25 turns ago.
- A research assistant with daily 10-turn sessions recurring over months.
**Task D — explain how a checkpointer and thread_id give a stateless model memory.
| Term | Definition |
|---|---|
| Buffer memory | Pattern storing every message verbatim; linear token growth |
| Window memory | Pattern keeping only the last k turns; stable cost, drops older context |
| Summary memory | Pattern compressing older turns into an LLM-generated summary; low cost, lossy |
| Hybrid memory | Pattern combining rolling summary of older turns with verbatim recent buffer |
| Semantic drift | Accumulated distortion from lossy summarization — details diverge from what was actually said |
RunnableWithMessageHistory |
LangChain wrapper that loads/saves conversation history automatically per session_id
|
session_id |
Unique identifier for a conversation; enables one chain to serve many concurrent sessions |
| Persistent memory | Memory backed by a database or file store that survives across process restarts |
| LangGraph State Schema | Typed structured state for multi-agent systems; explicit, testable, auditable |
| Cost-quality trade-off | The framework for selecting a memory pattern by weighing fidelity against token cost |
Before proceeding to the Chapter 3 Quiz, verify you can reconstruct the reference table (Task A) and complete Task C without consulting the guide.
Sources covered:
- Gao, Y., et al. (2023). Retrieval-augmented generation for large language models: A survey. arXiv:2312.10997. (Section 5 — Advanced RAG patterns)
- LangChain Expression Language (LCEL) Documentation
- Es, S., et al. (2024). RAGAS: Automated evaluation of retrieval augmented generation. EACL 2024. (Background — for optimization feedback loops)
Estimated study time: ~15 minutes (Gao et al. Section 5) + ~15 minutes (LCEL documentation)
Chapter connection: This guide builds directly on Reading Guide 2's six-stage pipeline. Section 5 of Gao et al. describes the Advanced RAG optimizations that extend the baseline Naive RAG pipeline. The LCEL documentation provides the implementation patterns for the optimization experiment in the Hands-On Project.
A Naive RAG pipeline makes two implicit assumptions that often fail in practice: (1) that fixed-size chunking produces retrievable units of appropriate granularity for all query types, and (2) that cosine similarity to the query embedding is the optimal criterion for selecting which chunks to inject into the generation context. Advanced RAG optimization systematically relaxes both assumptions. Chunking strategy selection, retrieval method selection (similarity vs. MMR), metadata filtering, re-ranking, and context compression are five complementary optimization levers that together determine context quality — the most important determinant of generation quality.
| Term | Working Definition |
|---|---|
| Fixed-size chunking | Splitting documents into chunks of a specified character or token count, regardless of semantic boundaries; simple but may fragment logical units |
| Semantic chunking | Splitting documents at natural semantic boundaries (paragraphs, sections, sentences) to preserve coherent units of meaning |
| Hierarchical chunking | Maintaining multiple chunk granularities (e.g., parent document + child sentence chunks) and using the child chunks for retrieval while injecting the parent for generation context |
| Similarity search | Retrieval by selecting the k chunks whose embeddings have the highest cosine similarity to the query embedding; may return redundant chunks from near-duplicate content |
| Maximum Marginal Relevance (MMR) | A retrieval method that balances relevance to the query with diversity among retrieved chunks, reducing redundancy when the corpus contains near-duplicate content |
| lambda_mult | The MMR diversity parameter (0–1): λ=1 is pure similarity search; λ=0 is pure diversity maximization; λ=0.5 is equal weighting |
| Metadata filtering | A pre-retrieval filter applied to the vector store that restricts retrieval to documents matching specified metadata criteria (e.g., source document, date range, document category) |
| Re-ranking | A post-retrieval step that applies a more accurate cross-encoder model to re-score and reorder the initially retrieved chunks before context injection |
| Context compression (LLMLingua) | A technique that uses a small LLM to remove query-irrelevant sentences from retrieved chunks before context injection, reducing token cost while preserving information density |
| Single-variable experimentation | A scientific control principle: changing one pipeline parameter at a time while holding all others constant, enabling the attribution of performance changes to specific design decisions |
| Cross-encoder | A model architecture that jointly encodes the query and a candidate document to produce a relevance score; more accurate than bi-encoder (embedding) retrieval but computationally more expensive |
Section A — Gao et al. (2023): Section 5 — Advanced RAG
-
Gao et al. organize Advanced RAG optimizations into pre-retrieval, retrieval, and post-retrieval categories. Give one concrete example of an optimization in each category and explain the specific pipeline stage at which it operates and the failure mode it addresses.
-
The survey describes hierarchical chunking as a strategy for preserving semantic coherence while enabling fine-grained retrieval. Explain the "small-to-retrieve, large-to-read" pattern: what is retrieved, what is injected into the generation context, and why does this separation improve generation quality?
-
MMR introduces a diversity penalty that reduces the weight given to chunks similar to already-retrieved chunks. Under what specific corpus conditions is MMR strictly necessary rather than merely preferable? Identify two types of corpora where MMR would produce measurably better retrieval than similarity search.
-
Metadata filtering operates before retrieval (it restricts the search space), while re-ranking operates after retrieval (it reorders the results). What is the key advantage of pre-retrieval filtering over post-retrieval re-ranking in terms of computational cost? What does post-retrieval re-ranking provide that metadata filtering cannot?
-
Context compression (LLMLingua) introduces an additional LLM call to compress retrieved chunks. What is the specific optimization trade-off? Under what deployment conditions — high token cost, very long documents, query-focused tasks — does context compression deliver a positive ROI?
Section B — LCEL Documentation: Implementation Patterns
-
What does wrapping a retriever as an agent tool allow that a fixed retrieve-then-generate sequence does not?
-
The LCEL documentation describes
RunnablePassthroughandRunnableParallelas composition primitives. What do these primitives allow a practitioner to do with the retrieved context before it is passed to the generation step? Give one concrete optimization use case for each. -
The Hands-On Project optimization experiment requires running three experimental configurations, plus an optional fourth, and measuring mean evaluation score for each. Why does the experiment protocol specify that all four runs must use the same evaluation query set and the same evaluation rubric? What would happen to the validity of the conclusions if different query sets were used for different runs?
-
The chapter lesson states that "chunking is the most consequential single decision in RAG pipeline design." Given that all six optimization levers (chunking, MMR, metadata filtering, re-ranking, context compression, k selection) affect context quality, what evidence would you need to evaluate whether chunking is more consequential than retrieval method selection? How would you design an experiment to test this claim?
-
MMR's lambda_mult parameter must be tuned for the specific corpus and query distribution. In a production system where the corpus is continuously updated (new documents added daily), how would you monitor whether the optimal lambda_mult value has shifted? What RAGAS metric would be the leading indicator of a MMR tuning problem?
Reading Guide 5 — Chapter 5: RAGAS Evaluation — From Subjective Impression to Structured, Reproducible Diagnosis
Sources covered:
- Es, S., James, J., Anke, L. E., & Schockaert, S. (2024). RAGAS: Automated evaluation of retrieval augmented generation. EACL 2024. (Abstract + Sections 1–2)
- Gao, Y., et al. (2023). (Background context on RAG failure modes)
Estimated study time: ~20 minutes (Es et al. full paper preview) + ~10 minutes (Gao et al. failure modes cross-reference)
Chapter connection: RAGAS is the evaluation framework applied in Chapter 5 and the feedback mechanism that validates the optimization experiments in the Hands-On Project. Read the paper before the lab, not concurrently — understanding what each metric measures enables you to interpret your lab results analytically rather than descriptively.
Es et al. (2024) introduced RAGAS to solve a reproducibility and scalability problem in RAG evaluation: human judgment-based assessment is slow, expensive, and inconsistent across evaluators. RAGAS provides four automated metrics that together cover the two critical quality dimensions of a RAG system: the quality of the retrieval (did the system retrieve the right information?) and the quality of the generation (did the LLM use the retrieved information faithfully and relevantly?). The four metrics — faithfulness, answer relevance, context precision, and context recall — form a diagnostic instrument: each metric's score points to a specific pipeline stage as the source of a quality failure.
| Term | Working Definition |
|---|---|
| Faithfulness | RAGAS metric measuring whether all claims in the generated answer are supported by the retrieved context; specifically targets hallucination (generation that contradicts or goes beyond the retrieved evidence) |
| Answer relevance | RAGAS metric measuring whether the generated answer directly addresses the user's question; targets generation failures where the answer is factually grounded but non-responsive to what was asked |
| Context precision | RAGAS metric measuring the proportion of retrieved chunks that are genuinely relevant to the query; targets retrieval failures where the retrieved context contains excessive noise |
| Context recall | RAGAS metric measuring the proportion of ground-truth answer information that is present in the retrieved context; requires a reference answer; targets retrieval failures where relevant information is missing from the retrieved set |
| LLM-as-judge | The evaluation approach used by RAGAS: a capable LLM evaluates the quality of another LLM's output by scoring it against defined criteria — enabling automated, scalable evaluation without human annotators |
| Reference answer | A ground-truth answer to a query, required for computing context recall; produced by human annotation or by an oracle system |
| Hallucination | A generated claim not supported by the retrieved context — the failure mode most directly measured by the faithfulness metric |
| Retrieval failure | A class of RAG failure where the retrieval stage fails to surface relevant documents, leading to a generation that cannot be grounded in evidence — diagnosed by low context recall |
| Context overflow | A failure mode where the retrieved context is so large that it exceeds the LLM's context window or dilutes the relevant information with irrelevant content — diagnosed by low context precision |
| Diagnostic signature | The specific pattern of RAGAS metric scores that identifies a particular failure mode; e.g., low faithfulness + high context recall = generation failure (the LLM ignored the retrieved evidence) |
Section A — Es et al. (2024): Abstract + Sections 1–2
-
Es et al. identify the primary motivation for RAGAS as the inadequacy of human-judgment-based evaluation for RAG systems. What two properties of RAG evaluation make human judgment specifically inadequate — properties that do not apply equally to evaluating a simple text classification model?
-
The faithfulness metric measures whether all claims in the generated answer are entailed by the retrieved context. What is the mathematical formulation of this metric? Specifically, how does RAGAS operationalize "entailment" in a way that enables automated scoring without human annotators?
-
Answer relevance measures whether the answer addresses the user's question. How does RAGAS quantify this — what is the scoring mechanism? A generated answer can score high on faithfulness (all claims grounded in retrieved context) and low on answer relevance simultaneously. Construct a concrete example of this failure pattern.
-
Context precision measures the signal-to-noise ratio in the retrieved context. What specific pipeline stage (from the six-stage model) is the primary target of context precision optimization? What chunking or retrieval configuration changes would most directly improve a low context precision score?
-
Context recall requires a ground-truth reference answer — unlike the other three metrics. Why does context recall require a reference answer when faithfulness and answer relevance do not? What does context recall measure that the other metrics cannot?
Section B — Failure Mode Diagnosis
-
RAGAS metrics map to three RAG failure modes. Complete the following mapping from the chapter lesson:
- Low faithfulness + high context recall → failure mode: ____ → primary remediation: ____
- Low context recall + high faithfulness → failure mode: ____ → primary remediation: ____
- Low context precision + low faithfulness → failure mode: ____ → primary remediation: ____
-
A RAG system produces the following RAGAS scores: faithfulness = 0.92, answer relevance = 0.88, context precision = 0.45, context recall = 0.87. Diagnose the system's primary failure mode and specify which pipeline stage is most likely responsible. Propose one concrete remediation and predict which metric would improve first if the remediation is effective.
-
A different RAG system scores: faithfulness = 0.61, answer relevance = 0.85, context precision = 0.89, context recall = 0.43. Diagnose the failure mode. Is this more likely a retrieval failure or a generation failure? Justify your diagnosis by explaining the causal pathway from pipeline stage to metric score.
-
Es et al. propose using RAGAS as a component of a CI/CD pipeline for continuous RAG quality monitoring. What does this imply about the frequency at which RAGAS evaluations should be run in production? What corpus or pipeline event would trigger an unscheduled evaluation?
-
RAGAS uses an LLM as a judge to evaluate another LLM's outputs. What is the fundamental limitation of this approach? Under what conditions might the judge LLM systematically fail to detect faithfulness violations — and what does this imply about the choice of judge model relative to the generation model?
-
The chapter lesson states that RAGAS enables "rapid, reproducible, and actionable evaluation that can be integrated into a CI/CD pipeline." For a RAG system serving a high-stakes domain (medical literature, legal research), is automated RAGAS evaluation sufficient for production monitoring, or does it need to be supplemented by human evaluation? If supplemented, which failure modes most require human judgment?
These quizzes are self-evaluating. For each question, select your answer, then read the feedback section immediately below. Feedback is provided for every option — including why incorrect options are wrong — so you can diagnose your reasoning, not just verify your answer.
Each quiz has 5 questions. Two attempts are permitted; your best score is retained.
Based on Reading Guide 1: Lewis et al. (2020), Bommasani et al. (2021), IBM Technology Video
Question 1. Parametric knowledge is knowledge encoded in a model's weights during training. Which statement most precisely explains why this encoding mechanism makes parametric knowledge difficult to update?
A. Parametric knowledge is stored in a proprietary format that third-party developers cannot access or modify.
B. Updating parametric knowledge requires modifying the weight values distributed across billions of parameters through a retraining process, which is computationally expensive and resets the model's behavior across all tasks — not just the target update.
C. Parametric knowledge is encrypted during training to protect the intellectual property of the training data, making post-hoc modification legally prohibited.
D. Parametric knowledge can only be updated by adding new training examples to the original training dataset, which is typically not retained after the initial training run is complete.
Correct Answer: B
✅ B is correct. Parametric knowledge is not stored in a localized, addressable location — it is diffusely distributed across the billions of weight values that collectively determine model behavior. Updating a single factual claim requires retraining, which adjusts weights globally via backpropagation. This process: (1) is computationally expensive (potentially millions of dollars in compute for large models); (2) risks "catastrophic forgetting" — degrading performance on tasks not related to the target update; and (3) takes hours to weeks, making it unsuitable for knowledge that changes frequently. This is the structural reason RAG is necessary for dynamic, organization-specific knowledge.
❌ A is incorrect. The difficulty of updating parametric knowledge is not about access formats or proprietary storage — it is about the distributed, non-addressable nature of weight-based encoding. Open-source models with fully accessible weights face exactly the same update difficulty as proprietary models.
❌ C is incorrect. Model weights are not encrypted after training; the difficulty is architectural, not legal. Research on model editing (e.g., ROME, MEMIT) specifically attempts to address the difficulty of localized weight updates for open-weight models — the challenge is technical, not a legal access barrier.
❌ D is incorrect as stated. Fine-tuning (updating model weights on new data) does not require the original training dataset — it can be performed on a small domain-specific dataset. However, fine-tuning still requires compute and still risks the other problems described in option B. The answer captures a real constraint but misidentifies dataset availability as the primary obstacle.
Question 2. Lewis et al. (2020) describe RAG as a system that "jointly reasons over parametric and non-parametric memory." A legal research assistant uses a RAG system to answer questions about recent case law. Which scenario demonstrates the critical necessity of non-parametric memory for this application?
A. The assistant must answer a question about the general principles of contract law, which are stable and well-represented in the model's training data.
B. The assistant must answer a question about a landmark Supreme Court ruling from 2019 that was widely covered and is therefore likely in the model's training data.
C. The assistant must answer a question about a district court ruling issued three months ago that postdates the model's training cutoff and is contained only in the firm's internal document corpus.
D. The assistant must answer a question requiring multi-step legal reasoning — a capability determined by the model's parametric reasoning ability, not by its memory architecture.
Correct Answer: C
✅ C is correct. This scenario directly demonstrates both limitations that non-parametric memory addresses: (1) the ruling postdates the training cutoff, so it cannot be in the model's parametric memory regardless of how capable the model is; (2) the document is in the firm's internal corpus — proprietary, organization-specific content that would never appear in a general-purpose model's training data even if the model were retrained. The non-parametric retrieval index, built from the firm's document corpus, is the only path to a grounded answer. Without RAG, the model would either produce a hallucinated "ruling" or correctly refuse to answer.
❌ A is incorrect. General principles of contract law are stable, widely documented, and reliably encoded in any large model's parametric memory. This scenario demonstrates parametric memory working well — it does not motivate the necessity of non-parametric augmentation.
❌ B is incorrect. A widely covered 2019 ruling is highly likely to be in the training data of most modern large models (which typically have training cutoffs in 2023 or later). Parametric memory alone would handle this query reliably. This scenario does not require non-parametric memory.
❌ D is incorrect. Multi-step legal reasoning is a capability of the model's parametric reasoning architecture, not a memory architecture issue. The scenario described in D would be the same regardless of whether RAG is used — the retrieval component provides evidence; the generative component performs the reasoning. D confuses reasoning capability with memory architecture.
Question 3. According to Lewis et al. (2020), RAG combines two distinct components. Which description most precisely identifies both components and their respective contributions?
A. A fine-tuned generative model (which encodes domain-specific knowledge) and a keyword search engine (which retrieves relevant documents by term matching).
B. A parametric generative model (which provides language understanding, reasoning, and generation capability) and a non-parametric retrieval component (which surfaces relevant documents from an external index at inference time to ground the generation).
C. A large language model (which generates responses) and a fine-tuning dataset (which stores facts that the model cannot memorize during pretraining).
D. A question-answering model (which extracts answers from documents) and a document retriever (which selects which documents to pass to the QA model).
Correct Answer: B
✅ B is correct. Lewis et al.'s formal definition of RAG combines: (1) a parametric generative model — a sequence-to-sequence model (in the original paper, BART) that provides language understanding, multi-step reasoning, and fluent text generation from the combined input of the query and retrieved context; and (2) a non-parametric dense retrieval component (DPR — Dense Passage Retriever) that encodes documents and queries as dense vectors and retrieves the most semantically relevant documents at inference time. The non-parametric descriptor is technically precise: the retrieval index stores document representations without encoding them in model parameters, making the knowledge externally verifiable and updatable without retraining.
❌ A is incorrect. The original RAG architecture does not use a fine-tuned domain-specific generative model (fine-tuning is a separate step, not the architecture). More critically, the retrieval component is a dense semantic retriever (DPR), not a keyword search engine — semantic retrieval operates on learned dense embeddings and finds relevant passages by semantic similarity, not term co-occurrence.
❌ C is incorrect as a precise description. Describing the retrieval component as a "database that stores facts the model cannot memorize" conflates the function of an external knowledge base with the architectural role of a semantic retrieval index. The retrieval component does not store discrete facts — it stores dense vector representations of document passages and retrieves them by semantic similarity to the query.
❌ D is incorrect. The extractive QA framing (extract an answer span from a document) describes traditional reading comprehension models, not RAG. RAG is a generative architecture: the generative model produces a synthesized answer using the retrieved documents as grounding context — it does not extract a literal span. This distinction matters: RAG can synthesize information across multiple retrieved passages, which extractive QA cannot.
Question 4. A healthcare organization deploys an LLM to help clinical staff answer questions about medication dosing. The organization argues that because the LLM was trained on extensive medical literature, non-parametric memory (RAG) is unnecessary. Which argument most effectively challenges this position?
A. LLMs cannot reason about medical information because they lack a medical license and are therefore legally prohibited from making clinical recommendations.
B. Parametric memory cannot reliably encode the organization's formulary, patient-specific contraindications, or protocol updates issued after training cutoff — all of which constitute safety-critical, institution-specific, and dynamic knowledge. These are precisely the "long tail" properties Bommasani et al. identify as unreliable in parametric memory, and they are safety-critical in a clinical setting.
C. LLMs always hallucinate in medical contexts, making them unsuitable for clinical use regardless of whether RAG is added.
D. The LLM's parametric knowledge becomes outdated after six months and therefore requires quarterly retraining, which is cost-prohibitive without a RAG architecture to reduce retraining frequency.
Correct Answer: B
✅ B is correct. This argument targets the three specific failure modes of parametric memory that are most consequential in a clinical context: (1) Organization-specific knowledge — the hospital formulary, local protocols, and internal clinical guidelines are proprietary content that was never in the model's training data. (2) Temporal currency — drug approvals, dosing guideline updates, and safety alerts issued after the training cutoff are absent from parametric memory. (3) Patient-specific context — contraindications based on a specific patient's record are dynamic, individual-level knowledge that no general parametric model can encode. These are the specialized, proprietary and dynamic kinds of knowledge that the lesson (drawing on Bommasani et al.'s framing) identifies as outside what can be efficiently encoded in parameters, and they are safety-critical in a clinical setting.
❌ A is incorrect. Legal prohibition is not an argument about memory architecture — it is a regulatory concern about deployment context. The argument against parametric-only systems must be grounded in the architectural limitation (inability to encode institution-specific, dynamic knowledge), not in licensing requirements.
❌ C is incorrect. While LLMs can and do hallucinate in medical contexts, the claim that they "always hallucinate" is factually false. High-capability models demonstrate reliable performance on well-represented medical knowledge questions. The challenge is not blanket unreliability but specific failures on long-tail, dynamic, and institution-specific knowledge — precisely what option B addresses.
❌ D is incorrect in its framing. The six-month figure is arbitrary and is not grounded in the lesson or the assigned readings. The core argument is not primarily about retraining cost reduction (though RAG does reduce that cost) — it is about the structural impossibility of encoding organization-specific and dynamically changing knowledge in parametric weights at any retraining frequency.
Question 5. The IBM Technology video explains that RAG "grounds" the model's generation in retrieved documents. In the context of Lewis et al.'s architecture, what does grounding technically mean, and why is it valuable?
A. Grounding means the LLM is connected to the internet in real time, enabling it to verify its answers against current web sources before generating a response.
B. Grounding means the generated answer is constrained to be consistent with and attributable to specific retrieved passages, enabling factual verification and reducing the probability of hallucination.
C. Grounding means the LLM's weights are updated based on the retrieved documents before generating the response, incorporating the new knowledge into parametric memory.
D. Grounding means the retrieved documents are summarized and added to the model's parametric knowledge base, providing a continuously updated factual foundation for generation.
Correct Answer: B
✅ B is correct. Grounding in the RAG context means that the generative model's output is conditioned on the retrieved documents — technically, the retrieved passages are concatenated with the query and passed as input to the generative model, so the model's attention mechanism attends to both the query and the retrieved evidence simultaneously. This architectural conditioning means that a well-functioning RAG system generates answers consistent with the retrieved evidence rather than with potentially stale or confabulated parametric knowledge. Grounding is valuable because it: (1) reduces hallucination (claims not in the training data cannot as easily be generated if relevant evidence is present); (2) enables attribution (answers can be traced to specific source passages); and (3) makes the knowledge basis auditable.
❌ A is incorrect. Standard RAG architectures do not connect to the internet in real time — the retrieval component queries a pre-built, offline vector index. Real-time web search integration is a separate architectural pattern (sometimes called "search-augmented generation") that is not what Lewis et al. describe.
❌ C is incorrect. This describes fine-tuning, not RAG. In RAG, the model's weights are never updated during inference — the retrieved documents are provided as input context, not as gradient signals for weight updates. The non-parametric nature of RAG's retrieval component means the knowledge is in the index, not in the weights.
❌ D is incorrect. This describes a hypothetical continuous learning or knowledge base update architecture, not RAG. In the RAG architecture, retrieved documents are not added to the model's parametric memory — they remain in the external non-parametric index. The model's weights are unchanged at inference time.
Based on Reading Guide 2: Gao et al. (2023), Lewis et al. (2020), LangChain Documentation, KodeKloud Video
Question 1. Gao et al. (2023) describe six stages of the RAG pipeline. A practitioner observes that their RAG system consistently retrieves documents that are semantically related to the query but do not contain the specific information needed to answer it. At which pipeline stage is the most likely root cause, and what is the technical explanation?
A. Stage 1 (Document Ingestion) — the document loader failed to extract all text from the source PDFs, leaving relevant content unloaded.
B. Stage 3 (Embedding Generation) — the embedding model is not encoding the semantic content of the documents accurately, producing embeddings that do not capture the relevant information.
C. Stage 2 (Text Splitting / Chunking) — chunks are much larger than the unit of information the query asks about, so they contain the relevant information mixed with extensive irrelevant content, producing embeddings that represent a blend of topics rather than the specific information the query requires, causing retrieval of thematically related but answer-irrelevant chunks.
D. Stage 6 (Augmented Generation) — the LLM is ignoring the retrieved context and generating answers from parametric memory, making the retrieval quality irrelevant.
Correct Answer: C
✅ C is correct. This symptom — semantically related but answer-irrelevant retrieval — is the characteristic failure mode of oversized chunks. When a chunk is too large, its embedding is a vector average over many sentences and topics. The resulting embedding is semantically similar to many queries about the general topic but is not precisely aligned to any specific query. The retriever selects chunks whose embeddings are closest to the query embedding — but if the chunk embedding blends topically relevant content with irrelevant content, the retrieved chunk may score high on thematic similarity while not containing the specific answer the query requires. Reducing chunk size (so each chunk represents a more atomic unit of information) directly addresses this failure mode, provided the new chunks stay larger than the coherent unit the query needs. If chunks become smaller than that unit, the unit is fragmented instead, which is the opposite failure discussed in the Chapter 4 quiz.
❌ A is incorrect. Document ingestion failures typically manifest as missing document sections or entirely absent documents, not as retrieval of semantically related but answer-irrelevant content. If ingestion had failed partially, certain documents would be absent from the index entirely — retrieval would return no results or results from other documents, not topically related but answer-incomplete results.
❌ B is incorrect as the primary diagnosis. While a poor embedding model can cause retrieval quality problems, modern embedding models (OpenAI text-embedding-3-small, all-MiniLM-L6-v2) are sufficiently capable for most domain corpora. The symptom described — semantically related but not specifically answer-relevant results — is more characteristically explained by chunking granularity (Stage 2) than by embedding model failure (Stage 3).
❌ D is incorrect. Stage 6 failure (LLM ignoring retrieved context) would manifest as a faithfulness failure — the generated answer contradicts or goes beyond the retrieved context — not as a retrieval quality problem. If the retrieved chunks were answer-relevant but the LLM ignored them, answer quality might still be low, but the diagnosis and remediation would be at Stage 6, not Stage 2.
Question 2. Gao et al. (2023) distinguish Naive RAG, Advanced RAG, and Modular RAG as three evolutionary paradigms. Which statement correctly identifies a specific limitation of Naive RAG that Advanced RAG addresses?
A. Naive RAG cannot use LLMs for generation — it uses a separate extractive QA component, which Advanced RAG replaces with a generative model.
B. Naive RAG performs a single retrieval pass on the raw user query, which may be poorly formed for embedding-based retrieval; Advanced RAG addresses this with query transformation techniques (e.g., query rewriting, HyDE) that improve the alignment between the query embedding and the relevant document embeddings before retrieval.
C. Naive RAG cannot handle PDF documents as a source format; Advanced RAG introduces PDF parsing capabilities through specialized document loaders.
D. Naive RAG is limited to a single vector store backend; Advanced RAG enables multi-source retrieval across heterogeneous databases, including relational databases and knowledge graphs.
Correct Answer: B
✅ B is correct. A fundamental limitation of Naive RAG is that it embeds the user's raw query and retrieves documents based on that embedding. User queries are often underspecified, colloquially phrased, or conceptually distant from the way the relevant information is expressed in the corpus — a phenomenon sometimes called the "query-document vocabulary mismatch." Advanced RAG addresses this with pre-retrieval query transformation techniques: query rewriting (using an LLM to rephrase the query to match corpus terminology), HyDE (generating a hypothetical document the retrieval index would return for the ideal answer, then using that document's embedding for retrieval), and multi-query retrieval (generating multiple query variants and merging the retrieved sets). These techniques systematically improve the alignment between query embedding and relevant document embeddings.
❌ A is incorrect. Both Naive and Advanced RAG use generative models. The generative component is present in all three RAG paradigms — it is the retrieval strategy and pipeline structure that evolves, not the replacement of extraction with generation.
❌ C is incorrect. Document format support (PDF, Word, HTML, etc.) is determined by the document loaders used at Stage 1, not by the RAG paradigm. Naive RAG can use PDF loaders; the paradigm distinction is about retrieval and generation strategy, not ingestion format support.
❌ D is incorrect. Multi-source retrieval across heterogeneous backends is a feature more associated with Modular RAG than with the transition from Naive to Advanced RAG. Advanced RAG's primary improvements over Naive RAG are in query transformation (pre-retrieval) and re-ranking/compression (post-retrieval), not in multi-backend integration.
Question 3. In the six-stage RAG pipeline, the chunk_overlap parameter in the text splitter specifies the number of characters shared between adjacent chunks. What specific problem does chunk overlap address, and what is the engineering trade-off it introduces?
A. Chunk overlap prevents the embedding model from processing identical text twice, reducing computational cost; the trade-off is that overlapping chunks may have slightly different embeddings for the same content, introducing retrieval inconsistency.
B. Chunk overlap preserves contextual continuity across chunk boundaries — ensuring that information that spans two adjacent chunks (e.g., a sentence that begins at the end of one chunk and concludes at the start of the next) is fully represented in at least one chunk; the trade-off is increased total number of chunks and therefore increased vector store storage and indexing cost.
C. Chunk overlap ensures that every chunk has the same semantic density, preventing some chunks from containing only low-information content like headers and whitespace; the trade-off is that overlap increases the average chunk size.
D. Chunk overlap allows the retriever to return overlapping chunks as a single merged context block, reducing the total number of retrieval calls needed; the trade-off is increased latency per retrieval operation.
Correct Answer: B
✅ B is correct. Without chunk overlap, the splitting algorithm cuts the document at fixed character boundaries regardless of semantic structure. Information that spans a chunk boundary — a sentence, a data value, a clause — may be split such that neither chunk contains the complete information. A reader of either chunk would encounter a fragment. Chunk overlap ensures that the last N characters of one chunk appear at the beginning of the next, so boundary-spanning information is fully represented in at least one chunk. The trade-off is real and quantifiable: with chunk_size=256 and chunk_overlap=25 (the lab baseline, both measured in characters), each overlap region adds up to 25 characters of duplicated content, increasing the total number of chunks relative to zero-overlap splitting and increasing vector store size and embedding computation proportionally.
❌ A is incorrect. Chunk overlap does not prevent the embedding model from processing identical text — it explicitly causes the embedding model to process the overlapping characters twice (once as part of each adjacent chunk). The motivation is not computational efficiency; it is information preservation at chunk boundaries.
❌ C is incorrect. Chunk overlap does not equalize semantic density across chunks. A chunk that begins at a document section header may still contain primarily low-information structural text regardless of overlap. Semantic chunking strategies (which split at natural boundaries) are the appropriate technique for equalizing semantic density — overlap is about boundary continuity, not density normalization.
❌ D is incorrect. Chunk overlap does not enable the retriever to merge overlapping chunks — the retriever returns individual chunk objects as stored. Overlap affects the content of each stored chunk, not the retrieval mechanism or the merging behavior. The retriever has no awareness of which chunks overlap.
Question 4. An agent answers questions using a retriever wrapped as a tool (agentic RAG). A practitioner runs a test query, inspects the passages returned by the retrieval tool, and confirms that the passage containing the relevant information was among them. The final answer, however, contains a specific factual claim that does not appear in any of the returned passages. What failure mode does this observation most precisely identify?
A. A retrieval failure — the relevant passages were not retrieved, so the model had no basis for the claim.
B. A faithfulness failure — the LLM generated a claim that is not supported by (and may contradict) the retrieved context, drawing on parametric memory instead of the retrieved evidence.
C. A context precision failure — too many irrelevant passages were retrieved, diluting the relevant context and causing the model to ignore the passages entirely.
D. A document ingestion failure — the document containing the relevant information was not loaded into the vector store, making retrieval of that information impossible.
Correct Answer: B
✅ B is correct. Because the relevant passage was retrieved and the answer still contains a claim that none of the returned passages support, the failure lies in the generation stage. This is a faithfulness violation, which is what the RAGAS faithfulness metric measures: the LLM went beyond its evidence and filled the gap with parametric memory. Inspecting the tool's returned passages (for example, in the agent's tool-call trace) makes such violations visible without running RAGAS. Note the contrast with the Chapter 5 quiz: if the relevant passage had not been retrieved, the same symptom would point first to a retrieval problem (low context recall), and the faithfulness failure would be a consequence of the evidence gap.
❌ A is incorrect. The stem states that the relevant passage was retrieved. A retrieval failure would show up as returned passages that are unrelated to the query or that lack the needed information.
❌ C is incorrect. Low context precision means a large share of the retrieved passages is irrelevant. It can contribute to weaker answers, but it does not by itself explain an unsupported claim when the relevant passage is present in the retrieved set.
❌ D is incorrect. An ingestion failure would mean the document is missing from the vector store, so the relevant passage could not have been retrieved. The stem says it was.
Question 5. Context precision and context recall (Chapter 5) are the two main retrieval quality dimensions. An organization is building a RAG system for medical literature review, where completeness (not missing any relevant study) is more important than precision (avoiding irrelevant studies). Which configuration change most directly optimizes for this priority, and what is the trade-off?
A. Increase chunk_size from 256 to 512 characters; this improves context recall because larger chunks contain more information per retrieval unit, but reduces precision because each chunk may contain topically mixed content.
B. Increase k (the number of retrieved chunks) from 4 to 8; this improves context recall by retrieving more candidate passages and thereby reducing the probability of missing a relevant study, but reduces context precision because more retrieved chunks increases the probability of including irrelevant content.
C. Switch from similarity search to MMR retrieval; this improves context recall by retrieving more diverse chunks, and context precision is unaffected because MMR's diversity criterion does not affect relevance scoring.
D. Reduce chunk_overlap from 25 to 0; this improves context recall because non-overlapping chunks cover more unique content per retrieval operation, while precision is maintained because each chunk is a distinct semantic unit.
Correct Answer: B
✅ B is correct. Increasing k directly addresses context recall: with more retrieved chunks in the context window, the probability that a relevant study's key passage is included in the retrieved set increases. This is the most direct and interpretable lever for improving recall. The trade-off is equally direct: a larger k brings more chunks into the context window, including a higher expected number of irrelevant chunks — degrading context precision and consuming more tokens. For a medical literature review application where missing a relevant study has clinical consequences, this trade-off (more tokens, lower precision, higher recall) is explicitly justified by the application's completeness requirement. This is a canonical example of the recall-precision trade-off appearing as a practical engineering decision.
❌ A is incorrect as the best answer. Increasing chunk_size does affect the amount of information per retrieved unit, but the relationship between chunk_size and context recall is indirect and corpus-dependent. Larger chunks may improve recall for queries requiring multi-sentence evidence, but they may also reduce recall for queries where the relevant information is a short, specific data point buried in a long passage. Increasing k (B) is the more direct and predictable lever for recall.
❌ C is incorrect. MMR's diversity criterion improves coverage across distinct topics in the corpus — which can improve recall for multi-faceted queries. However, the claim that "context precision is unaffected" is incorrect: MMR may return chunks that are less similar to the query than the top-k similarity search results, potentially including less relevant content. The relationship between MMR and recall is also corpus-dependent rather than guaranteed. B is the more precise and direct intervention.
❌ D is incorrect. Reducing chunk_overlap does not reliably improve context recall. Overlap addresses information completeness at chunk boundaries; removing it may cause boundary-spanning information to be lost in some chunks. The relationship between overlap and recall depends on how much relevant information in the corpus happens to span chunk boundaries — it is not a general recall improvement strategy.
A clinical documentation agent assists physicians during 8–10 turn patient encounters. Specific drug names, dosages, and contraindication details mentioned in early turns must be recalled exactly in later turns. Which memory pattern is most appropriate?
A. Summary — compresses older turns to save tokens while retaining key facts.
B. Window — keeps only the last k turns, which is sufficient for short sessions.
C. Buffer — stores every message verbatim, preserving complete fidelity.
D. Hybrid — combines summary with recent buffer, which is the recommended production default.
Feedback:
A ❌ — Summary memory uses lossy compression. Specific drug names and numerical dosages are precisely the details that may not survive summarization. In a clinical context where any missed detail is a patient safety risk, lossy memory is unacceptable.
B ❌ — Window memory drops messages older than k turns. If a contraindication was mentioned in turn 2 and the window is set to k=5, that information is permanently lost by turn 8. The scenario requires recall across the full session.
C ✅ — Buffer stores every message verbatim. Sessions are short (8–10 turns), so token growth will not overflow the context window. Maximum fidelity is required — every clinical detail must be preserved exactly. Both conditions align with Buffer memory.
D ❌ — Hybrid is the recommended default for long, dense conversations. For a short session where complete fidelity is required, Buffer is simpler and provides the same (or better) fidelity without the complexity of managing a summary component.
A coding assistant handles long debugging sessions averaging 40+ turns. The user frequently references decisions made 20–30 turns ago, but also relies heavily on the last few turns of code output. Token cost must remain manageable. Which memory pattern best fits?
A. Buffer — ensures nothing is lost across the full session.
B. Window (k=5) — keeps the most recent context, which is what matters for debugging.
C. Summary — compresses the full session into a bounded summary.
D. Hybrid — rolling summary of older turns + verbatim buffer of recent turns.
Feedback:
A ❌ — Buffer stores all 40+ turns verbatim. At this session length, token cost grows linearly and may approach context window limits — violating the cost constraint.
B ❌ — A window of k=5 discards everything beyond the last 5 turns. The scenario specifies that the user references decisions from 20–30 turns ago — Window memory cannot recall those.
C ❌ — Summary compresses older turns but loses exact code snippets and specific variable names from earlier debugging steps. When the user references a decision from turn 12, the summary may not preserve the precise details needed.
D ✅ — Hybrid keeps a rolling summary of older turns (preserving key decisions at low cost) and a verbatim buffer of recent turns (preserving exact code output). This satisfies both requirements: long-range context and recent fidelity, within a manageable token budget. The lesson identifies this as the recommended default for production.
A conversational agent is built with create_agent. Which statement correctly describes the roles of the checkpointer and middleware in the agent's memory?
A. The checkpointer compresses older messages into a summary before each model call, and middleware stores the conversation in a database.
B. The checkpointer saves the agent's state (its list of messages) after every step, keyed by a thread_id; middleware, which is optional, controls how much of that history the model sees on each call, for example by dropping or summarizing older messages.
C. The checkpointer is required for the agent to call tools, and middleware is required for the agent to remember messages from earlier turns.
D. The checkpointer and middleware are LangGraph components that are needed only when several agents share a state; a single agent keeps its history without either of them.
Feedback:
A ❌ — The roles are reversed. Saving state is the checkpointer's job; deciding what the model sees (trimming or summarizing) is what middleware does. Summarization is one pattern that middleware can implement, and it is not what a checkpointer does.
B ✅ — The checkpointer persists the state after each step, and each conversation has its own thread_id, so one agent can serve many users without mixing their histories. With a checkpointer alone, the agent remembers the whole thread (Buffer behavior). Middleware is added when the full history is too long or too costly, and it implements the Window, Summary or Hybrid patterns by changing what the model sees.
C ❌ — Tool calling does not depend on a checkpointer. Remembering earlier turns within a thread is exactly what the checkpointer provides, and middleware is optional.
D ❌ — create_agent is itself built on LangGraph, and a single agent needs a checkpointer to remember earlier turns. Multi-agent state is a Module 4 topic and is not a prerequisite for the checkpointer.
A student claims: "Window memory is strictly worse than Hybrid memory because Hybrid includes a buffer for recent turns and also preserves older context via summary." What is the flaw in this reasoning?
A. Window memory has lower token cost and simpler implementation — for applications where older context genuinely doesn't matter (e.g., a customer support bot where each issue is resolved within a few turns), the added complexity of Hybrid provides no benefit.
B. Window memory actually preserves older context through compression, making it equivalent to Hybrid.
C. Hybrid memory requires two LLM calls per turn (one for summary, one for generation), making it twice as expensive as Window in all cases.
D. The claim is correct — Hybrid is always preferred over Window in production systems.
Feedback:
A ✅ — Memory pattern selection is a cost-quality trade-off, not a universal ranking. Window memory is simpler, cheaper, and sufficient for use cases where only recent context matters. A customer support agent resolving issues in 5–8 turns gains nothing from summarizing older turns. "Strictly worse" ignores that the best pattern depends on the deployment scenario.
B ❌ — Window memory does not compress older turns — it drops them entirely. This is the key distinction from Hybrid, which preserves older context via summary.
C ❌ — Hybrid does add a summarization step, but the cost comparison depends on session length. For long sessions, Hybrid's bounded summary is cheaper than Buffer's unbounded growth. The claim that it's "twice as expensive in all cases" is incorrect.
D ❌ — The lesson presents four patterns as trade-offs, not a hierarchy. Each pattern has a best-fit use case.
An agent is built with create_agent and InMemorySaver, and each user conversation uses its own thread_id (for example, "customer-42"). After the application is restarted, users report that the agent has forgotten their earlier conversations. Which change restores memory across restarts while keeping each user's conversation separate?
A. Increase the window size k in the Window memory middleware so more messages are kept.
B. Replace InMemorySaver with a database-backed checkpointer (for example, SqliteSaver, or a PostgreSQL-based one in production) and continue to use a distinct thread_id per conversation.
C. Use one shared thread_id for all users so that the history is never lost.
D. Add summarization middleware so that older messages are summarized and kept.
Feedback:
A ❌ — The window size controls how many messages the model sees within a running thread. It does nothing about the loss of state at restart, because InMemorySaver keeps memory only while the program runs.
B ✅ — A database-backed checkpointer stores the state outside the running process, so a conversation can be resumed after a restart. The interface is the same as with InMemorySaver, and the thread_id still identifies which conversation to resume. Storing conversations also raises data governance questions (what is kept, for how long, and who can read it), which Module 5 addresses.
C ❌ — A single shared thread_id mixes all users' histories into one conversation. This leaks one user's messages into another's context and is the failure that separate thread_id values prevent.
D ❌ — Summarization middleware changes what the model sees. It does not store anything outside the process, so with InMemorySaver the summary is lost at restart too.
Based on Reading Guide 4: Gao et al. (2023) Section 5, LCEL Documentation
Question 1. Gao et al. (2023) state that chunking is "the most consequential single decision in RAG pipeline design." A RAG system serving a medical reference corpus consistently produces answers that are partially correct — they address the correct topic but omit critical dosing information that appears in the same passage as the correctly retrieved content. Which chunking strategy change most directly addresses this failure mode?
A. Increase chunk_overlap from 50 to 200 characters to ensure that boundary-spanning information is always fully represented in at least one chunk.
B. Switch from fixed-size chunking to recursive splitting (RecursiveCharacterTextSplitter, as used in the lab), which splits at paragraph and then sentence boundaries first, so that each chunk tends to correspond to a coherent medical concept (e.g., an indication, a dosing section, a contraindication section) rather than an arbitrary character count.
C. Reduce chunk_size from 512 to 256 characters so that each chunk is more atomically focused, reducing the probability that irrelevant content dilutes the relevant dosing information.
D. Increase k from 4 to 8 to retrieve more candidate chunks, increasing the probability that the dosing information is present somewhere in the retrieved set.
Correct Answer: B
✅ B is correct. The symptom — correct topic retrieval but missing critical dosing information from the same passage — indicates that the chunking boundary is splitting a medically coherent unit (e.g., an indication paragraph that includes both the condition description and the dosing regime) into two chunks. The condition description is in one chunk; the dosing information is in the next. Only the condition description chunk is retrieved (because it better matches the query embedding), and the dosing information is lost. Recursive splitting, which tries paragraph and sentence boundaries before cutting at a character count, preserves medically coherent units in single chunks - the indication and its associated dosing parameters stay together, ensuring that a relevant chunk retrieved for the condition query also contains the dosing information. Embedding-based semantic chunking (clustering sentences by similarity) and sentence-window retrieval (retrieve a sentence, then expand it with its surrounding context) are other strategies from the lesson's chunking table that address the same symptom; they are not offered as options here.
❌ A is incorrect. Increasing chunk_overlap addresses boundary-spanning information within a fixed-size split, but it does not change the fundamental problem: fixed-size splitting still breaks semantic units at arbitrary points. A 200-character overlap helps preserve context across the boundary but does not guarantee that the full dosing information — which may be 500 characters long — is captured in the same chunk as the condition description.
❌ C is incorrect. Reducing chunk_size from 512 to 256 would make the chunking problem worse, not better. Smaller chunks mean that medically coherent units (indication + dosing) are even more likely to be split across multiple chunks. The symptom indicates that the problem is fragmentation of coherent medical concepts, which smaller chunks would amplify.
❌ D is incorrect. Increasing k is a recall improvement strategy — it increases the probability that any relevant chunk is in the retrieved set. But if the dosing information is in a chunk that is not similar to the query embedding (because the chunk was split from its condition context), increasing k does not guarantee its retrieval. The root cause is chunking strategy, not retrieval depth.
Question 2. A RAG system is built on a corpus of 5,000 corporate policy documents, many of which share standard boilerplate language (e.g., the same legal disclaimer appears in 800 documents). A practitioner configures the retriever with similarity search (k=4) and observes that all four retrieved chunks frequently contain the same legal disclaimer in response to policy-related queries. Which retrieval method change most directly addresses this failure, and what parameter controls the key trade-off?
A. Switch to metadata-filtered retrieval and filter by document category to exclude legal disclaimer documents; the key trade-off is that queries genuinely about the legal disclaimers will return no results.
B. Switch from similarity search to MMR (Maximum Marginal Relevance) retrieval; the lambda_mult parameter controls the balance between relevance to the query and diversity among retrieved chunks — reducing lambda_mult increases the diversity penalty, reducing redundancy in the retrieved set.
C. Increase k from 4 to 8 to retrieve more chunks, which statistically increases the probability of retrieving diverse content alongside the boilerplate; no additional parameter tuning is required.
D. Switch to re-ranking with a cross-encoder, which scores each retrieved chunk on its unique informational contribution and penalizes chunks with near-identical content to already-selected chunks.
Correct Answer: B
✅ B is correct. This is the canonical scenario for which MMR was designed: a corpus with significant redundancy (the same boilerplate in 800 documents) causes similarity search to retrieve near-identical chunks because they all have high cosine similarity to any policy query. MMR addresses this by introducing a diversity penalty: after retrieving the first chunk, subsequent retrievals are scored as a weighted combination of similarity to the query and dissimilarity to already-retrieved chunks. The
lambda_multparameter (λ) controls this balance: at λ=1.0, MMR degenerates to pure similarity search; at λ=0.5, equal weight is given to relevance and diversity; at λ=0.0, pure diversity maximization occurs. For a high-redundancy corpus, λ values in the 0.3–0.5 range typically produce meaningfully diverse retrievals while maintaining relevance.❌ A is incorrect. Metadata filtering by category would require a reliable taxonomy that distinguishes boilerplate documents from substantive policy documents — a classification that may not exist in the metadata and would require manual annotation. More importantly, the boilerplate appears within substantive policy documents (not in separate documents), so filtering at the document level would not address boilerplate chunks within otherwise relevant documents.
❌ C is incorrect. Increasing k from 4 to 8 does not address redundancy — it makes it worse. With similarity search, the top 8 most similar chunks for a policy query in a boilerplate-heavy corpus will likely be 8 variations of the same boilerplate, not 4 boilerplate chunks and 4 substantive chunks. Higher k amplifies the redundancy problem.
❌ D is incorrect. Re-ranking with a cross-encoder improves the precision of retrieved chunks by rescoring them for relevance to the specific query, but standard cross-encoders do not inherently penalize near-duplicate content in the retrieved set. Cross-encoders score each chunk independently for relevance; they do not apply a diversity criterion across the set. MMR's diversity penalty (B) is the correct tool for redundancy reduction.
Question 3. The Hands-On Project asks you to change only one setting at a time between runs (Run 2 changes chunk_size, Run 3 changes the retrieval method, and optional Run 4 adds metadata filtering) and to compare the four RAGAS scores. A student argues that varying chunk_size and retrieval method simultaneously would produce results more quickly. What is the specific methodological flaw in the student's proposed approach?
A. Varying multiple parameters simultaneously violates LangChain's API constraints — the library requires sequential parameter updates.
B. Varying chunk_size and retrieval method simultaneously produces a confounded experiment: if the RAGAS scores change between runs, the practitioner cannot determine whether the change was caused by the chunk_size variation, the retrieval method variation, or an interaction between them — making the result uninterpretable for production decision-making.
C. Varying multiple parameters simultaneously increases the probability of a software error in the experiment configuration, introducing noise that could make either configuration appear artificially superior.
D. Varying two parameters at once would let the student finish with fewer runs than the protocol lists, and the number of runs is what the protocol evaluates.
Correct Answer: B
✅ B is correct. This is the foundational principle of controlled experimentation. If chunk_size and retrieval method change together and a RAGAS score improves, the improvement may come from (a) the chunk_size change alone, (b) the retrieval method change alone, or (c) an interaction between the two. Without knowing which, the practitioner cannot decide what to apply in production, and may discard a beneficial change because a harmful one masked it, or the reverse. The Chapter 4 practitioner tip states this rule: vary one parameter at a time, hold all others constant, and measure the impact on RAGAS metrics.
❌ A is incorrect. LangChain imposes no API constraint against changing several parameters at once. The constraint is methodological, not technical.
❌ C is incorrect. Configuration errors are a practical risk in any experiment, but they are not the central flaw. Even a perfectly executed experiment that changes two parameters at once produces results that cannot be attributed to either one.
❌ D is incorrect. The number of runs is not the purpose of the protocol and is not the methodological issue. Even if the student completed the experiment in fewer runs, the flaw would be the same: the score changes could not be attributed to a specific setting. The one-change-per-run structure is what makes each run interpretable.
Question 4. Context compression (LLMLingua) introduces an additional LLM inference call to compress each retrieved chunk before context injection. Under which deployment scenario is context compression most likely to deliver a positive ROI relative to uncompressed retrieval?
A. A RAG system with small (256-token) chunks and a low-context LLM backbone (4K context window), where each retrieved chunk contains primarily relevant content and compression would remove most of the useful information.
B. A RAG system with large (1,024-token) chunks retrieved from long-form technical documents, where a typical query requires information from only 2–3 sentences within each chunk, and the LLM backbone charges per input token or has a limited context window.
C. A RAG system using MMR retrieval, where the retrieved chunks are already maximally diverse and contain minimal redundant content, making compression redundant.
D. A RAG system serving real-time queries requiring sub-second response latency, where the additional LLM inference call for compression is justified because it reduces overall token processing time.
Correct Answer: B
✅ B is correct. Context compression delivers positive ROI when two conditions are simultaneously true: (1) the retrieved chunks are large (high token cost) and (2) only a portion of each chunk is relevant to the specific query. In this scenario, a 1,024-token chunk retrieved from a technical document may contain a 3-sentence relevant passage surrounded by 900 tokens of non-query-relevant content. Without compression, all 1,024 tokens are injected into the context window. LLMLingua identifies and removes the 900 tokens of non-relevant content, injecting only the ~100-token relevant passage. The ROI is: (cost of compression LLM call) vs. (savings from injecting 100 tokens instead of 1,024 tokens at the generation stage). When the generation LLM is expensive (per-token pricing), the context window is limited, or multiple chunks are retrieved, the savings at the generation stage typically exceed the compression call cost.
❌ A is incorrect. Small 256-token chunks are already compact, and if they contain primarily relevant content, compression removes useful information rather than noise. In this scenario, compression reduces context quality without meaningfully reducing token cost — the ROI is negative.
❌ C is incorrect. MMR retrieval produces diverse chunks, but diversity does not imply query-relevance of all content within each chunk. A diverse set of 512-token chunks can still contain large proportions of query-irrelevant text within each chunk. The relationship between retrieval diversity and intra-chunk relevance is independent — MMR does not make context compression unnecessary.
❌ D is incorrect. This scenario has the trade-off backwards. Context compression introduces an additional LLM inference call, which adds latency — it does not reduce overall response time for a real-time system. The benefit of compression is token cost reduction (and potentially quality improvement from removing noise), not latency reduction. For sub-second response latency requirements, context compression is typically counterindicated.
Question 5. A practitioner filling in the "average input tokens per query" column of the Experiment Log finds that the retrieved context block (k = 4 chunks) accounts for 68% of the input tokens in each query. They propose reducing k from 4 to 2 as a token-reduction strategy. What check should be completed before adopting this change?
A. A check that the vector store contains at least 2 chunks for every query in the test set — otherwise k=2 would return empty results.
B. A comparison of the four RAGAS scores (faithfulness, answer relevance, context precision, context recall) at k=4 and k=2 on the same test set, to determine whether the roughly 50% reduction in retrieved context costs more in answer quality than the token saving is worth, with particular attention to context recall and faithfulness.
C. A check that the embedding model produces embeddings of consistent quality for both 4-chunk and 2-chunk retrieved sets, since different retrieval depths may produce embeddings with different semantic coherence.
D. A comparison of API response latency at k=4 vs. k=2, to verify that the token reduction produces a measurable latency improvement that justifies the change.
Correct Answer: B
✅ B is correct. Reducing k from 4 to 2 roughly halves the retrieved context, but it also reduces the chance that all relevant information is in the context, so context recall may fall, and a thinner context can push the model to fill gaps from parametric memory, so faithfulness may fall as well. Because the experiment protocol scores every run with the same four RAGAS metrics on the same test set, the k=2 configuration should be run and scored like any other, and the Experiment Log should record the change in each score next to the change in input tokens. The project's final recommendation should then state whether the token saving justifies any quality loss.
❌ A is incorrect. Any non-empty corpus returns at least 2 chunks for a query, so the check does not address the quality risk. The relevant question is whether 2 chunks are enough to answer the test questions well.
❌ C is incorrect. The embedding model processes each chunk independently, upstream of retrieval, so k does not affect embedding quality.
❌ D is incorrect. Latency is a secondary benefit, and token cost is the stated motivation. A latency measurement does not show whether answer quality has been preserved, which is the main risk.
Based on Reading Guide 5: Es et al. (2024), Gao et al. (2023)
Question 1. Es et al. (2024) define the faithfulness metric as measuring whether all claims in the generated answer are supported by the retrieved context. A RAG system produces the following output for a query about a drug's approved indication:
Retrieved context: "Drug X is approved by the FDA for the treatment of moderate-to-severe plaque psoriasis in adults."
Generated answer: "Drug X is approved for the treatment of moderate-to-severe plaque psoriasis in adults and has shown promising results in clinical trials for rheumatoid arthritis."
Which statement correctly identifies the faithfulness violation and its diagnostic implication?
A. There is no faithfulness violation — the generated answer accurately describes Drug X's FDA approval, and adding information about clinical trials is an appropriate use of the model's parametric knowledge.
B. The generated answer contains a faithfulness violation: the claim "has shown promising results in clinical trials for rheumatoid arthritis" is not supported by the retrieved context and represents parametric knowledge injection — generating a claim beyond the retrieved evidence. The faithfulness score for this answer would be less than 1.0, indicating hallucination.
C. The faithfulness violation is that the generated answer omits key information from the retrieved context (the specific phrase "moderate-to-severe") — faithfulness measures completeness of retrieval, not accuracy of generation.
D. There is a faithfulness violation, but it is minor — adding clinical trial information is a beneficial enhancement that improves answer quality. The faithfulness metric should not penalize factually accurate additions from parametric memory.
Correct Answer: B
✅ B is correct. Faithfulness measures whether all claims in the generated answer are entailed by the retrieved context — not whether they are factually correct from the model's parametric knowledge. The claim about rheumatoid arthritis clinical trials is not present in the retrieved context. Even if this claim happens to be factually correct based on the model's training data, it constitutes a faithfulness violation because the retrieved context does not support it. In a high-stakes domain (medical, legal, financial), faithfulness violations are dangerous regardless of the factual accuracy of the parametric claim — the system cannot attribute the claim to a verifiable source, and the claim may be outdated, jurisdiction-specific, or simply incorrect. A faithfulness score < 1.0 is the diagnostic signal that the LLM is generating beyond its retrieved evidence.
❌ A is incorrect. This option commits precisely the error that faithfulness is designed to detect: treating parametric knowledge injection as "appropriate." In a RAG system deployed for medical reference, the restriction of answers to retrieved evidence is not optional — it is the primary safety guarantee. The faithfulness metric specifically flags this behavior as a failure, regardless of the claim's accuracy.
❌ C is incorrect. Faithfulness does not measure completeness of retrieval — that is context recall's domain. Faithfulness measures whether each claim in the generated answer is supported by the retrieved context. The omission of "moderate-to-severe" from the answer would be an answer relevance or accuracy concern, not a faithfulness violation (the generated answer includes this phrase correctly).
❌ D is incorrect. The faithfulness metric does penalize factually accurate additions from parametric memory, and this design choice is intentional. In domains where the system's authority derives from its ability to ground answers in cited sources, an answer that cannot be attributed to a retrieved source is less trustworthy than one that can — even if the claim happens to be correct. Faithfulness is a grounding metric, not an accuracy metric.
Question 2. A RAG system returns the following RAGAS evaluation scores: faithfulness = 0.91, answer relevance = 0.89, context precision = 0.38, context recall = 0.84. Which failure mode does this profile most precisely diagnose, and what is the most targeted remediation?
A. The system has a generation failure — the high context recall indicates that relevant documents are being retrieved, but the high faithfulness indicates the LLM is ignoring them; the remediation is to increase the temperature parameter to encourage the model to use the retrieved context.
B. The system has a context irrelevance / overflow problem — context recall is high (the relevant information is being retrieved) but context precision is low (many irrelevant chunks are also being retrieved, consuming context window space with noise). The remediation is to improve retrieval precision: reduce k, apply metadata filtering, use MMR, or compress the retrieved context (for example, with LLMLingua).
C. The system has a hallucination problem — the low context precision indicates that the LLM is generating claims based on retrieved noise rather than on the relevant evidence. The remediation is to strengthen the grounded-generation instruction in the prompt.
D. The system has a corpus coverage problem — the high context recall (0.84) is insufficient to cover the full range of queries, and context precision (0.38) indicates that half the documents in the corpus are irrelevant. The remediation is to expand the corpus with additional source documents.
Correct Answer: B
✅ B is correct. This RAGAS profile has a specific and unambiguous diagnostic signature: high faithfulness (the LLM is using the retrieved context faithfully, not hallucinating) + high answer relevance (the generated answers address the questions) + low context precision (less than 40% of retrieved chunks are genuinely relevant) + high context recall (most relevant information is present in the retrieved set). This is the textbook retrieval noise profile: the retriever is successfully finding the relevant information (high recall) but is also retrieving a large proportion of irrelevant chunks (low precision). The irrelevant chunks consume context window tokens and potentially dilute the LLM's attention, but because faithfulness is high, the LLM is not being misled by the noise — it is generating faithful answers despite it. The targeted remediations are precision-focused: MMR (reduces redundant retrievals), metadata filtering (restricts the search space), re-ranking (rescores for precision), or smaller chunks (reduces thematic mixing within each retrieved unit).
❌ A is incorrect. High faithfulness does not indicate the LLM is "ignoring" the retrieved context — it indicates the opposite: the LLM is generating answers that are well-supported by the retrieved context. Increasing temperature would not address the context precision problem and would likely decrease faithfulness.
❌ C is incorrect. The diagnosis is wrong. Hallucination is indicated by low faithfulness, and here faithfulness is 0.91, so the LLM is producing answers that are well supported by the retrieved context despite the noise. Strengthening the grounded-generation prompt is the remedy for a faithfulness problem, which this profile does not show. The profile's weakness is retrieval precision (0.38).
❌ D is incorrect. Context recall of 0.84 does not mean "insufficient corpus coverage" — it means 84% of the ground-truth answer information is present in the retrieved context, which is a strong recall score. Context precision of 0.38 does not mean "half the documents are irrelevant" — it measures the proportion of retrieved chunks (per query) that are relevant, not the proportion of documents in the corpus. Expanding the corpus would likely worsen precision further by increasing the retrieval candidate pool without improving the retrieval algorithm.
Question 3. RAGAS uses a language model as a judge to score answers automatically. In this course's lab, the same language model that writes the answers also scores them in the RAGAS step. Which problem does this setup create for the faithfulness score?
A. The judge model is slower than a human reviewer, so evaluation cannot be repeated after every pipeline change.
B. The judge and the generator share the same parametric beliefs. If the generator states a claim it "believes" is true but the retrieved context does not support it, the judge may also consider the claim plausible and score it as faithful, so faithfulness violations can be systematically under-detected.
C. The judge model has a smaller context window than the generator, so it truncates the retrieved context and misses violations in the truncated portion.
D. The judge model is run at a higher temperature than the generator, so its scores vary randomly between runs.
Correct Answer: B
✅ B is correct. Faithfulness asks whether each claim in the answer is supported by the retrieved context. A judge that independently "knows" the claim from its own parametric memory may accept it even when the context contains no supporting evidence. When the judge and generator are the same model, or models trained on similar data, they share the same biases, so the evaluation may under-report exactly the violations that matter most in high-stakes domains. This is a recognized limitation of LLM-as-judge evaluation [VERIFY whether Es et al. (2024) discuss it explicitly; otherwise attribute it to course guidance]. Practical mitigations are to use a judge from a different model family than the generator and to spot-check a sample of scores by hand, especially for answers that contain claims not present in the retrieved passages.
❌ A is incorrect. An automated judge is faster than human review, not slower. Speed and repeatability are the reason RAGAS can be run after every pipeline change.
❌ C is incorrect. Using the same model means the context windows are the same. Truncation would be a configuration problem, not a systematic bias of the setup described.
❌ D is incorrect. Judge models are normally run at or near temperature 0 for reproducible scoring. Random variation from a high temperature would be a configuration error, and nothing in the setup described implies it.
Question 4. A different RAG system produces the following RAGAS scores: faithfulness = 0.58, answer relevance = 0.86, context precision = 0.87, context recall = 0.39. Which prioritized remediation plan most precisely targets the highest-severity failure mode?
A. Priority 1: Improve answer relevance by refining the system prompt to instruct the LLM to address the user's question more directly. Priority 2: Address faithfulness by switching to a smaller, less creative LLM.
B. Priority 1: Improve context recall by increasing k, adjusting chunking so related content is not fragmented, reviewing corpus coverage, or rewriting queries — the low context recall (0.39) means the relevant information for 61% of ground-truth answer components is not being retrieved, starving the LLM of the evidence it needs. Priority 2: Re-score faithfulness after recall improves, and if it remains low, strengthen the grounded-generation instruction, since the LLM may be filling gaps with parametric knowledge.
C. Priority 1: Improve context precision (already at 0.87 — no action needed). Priority 2: Improve faithfulness by adding a post-generation fact-checking step using a cross-encoder.
D. Priority 1: Improve context recall by reducing chunk_size from 512 to 256 — smaller chunks cover more of the corpus per retrieval operation, improving recall coverage. Priority 2: Faithfulness will improve automatically once recall improves.
Correct Answer: B
✅ B is correct. This RAGAS profile is the inverse of Question 2's profile and has its own unambiguous diagnostic signature: low context recall (0.39) + high context precision (0.87) + low faithfulness (0.58). This is a retrieval gap profile: the retriever is finding highly relevant chunks when it retrieves (high precision) but is systematically missing a large portion of the relevant corpus content (low recall, meaning 61% of ground-truth answer components are not present in the retrieved set). With only 39% of the necessary evidence in the context window, the LLM faces a choice at each turn: refuse to answer (unhelpful), generate an incomplete answer (low quality), or fill the evidence gap with parametric knowledge (faithfulness violation). The low faithfulness score (0.58) is most plausibly a consequence of this evidence gap, because the model lacks the evidence it needs; it should be re-checked after recall improves. This is the recall-first reading from the lesson: when the relevant passages are not retrieved, fix retrieval before tuning generation. Remediation targets recall first: increase k, adjust chunking to avoid fragmentation, review corpus coverage, or rewrite queries to reach underrepresented parts of the corpus. Compare this with the Chapter 2 quiz, Question 4, where the relevant passage was retrieved and the failure therefore lies in generation.
❌ A is incorrect. Answer relevance at 0.86 is a strong score — the generated answers do address the user's questions. There is no answer relevance problem to address. Additionally, switching to a smaller LLM to address faithfulness is a blunt intervention that would likely degrade all other metrics; the correct diagnosis attributes faithfulness failures to the retrieval gap, not to generation creativity.
❌ C is incorrect. Context precision at 0.87 is healthy and requires no intervention — correctly identified. However, the proposed remediation for faithfulness (adding a post-generation fact-checking step) addresses a symptom rather than the root cause. If faithfulness is low because the LLM is filling retrieval gaps with parametric knowledge, fact-checking will flag the violations but will not reduce their frequency. Improving context recall (B) reduces the frequency of the gap-filling behavior at its source.
❌ D is incorrect. Reducing chunk_size from 512 to 256 increases the number of chunks but does not guarantee improved context recall. Recall is affected by whether the relevant information is being retrieved — which depends on the query-embedding alignment and k, not just chunk granularity. Smaller chunks may improve precision within each retrieved unit but can reduce recall if the relevant information is spread across now-smaller chunks that are less likely to be retrieved. Additionally, "faithfulness will improve automatically once recall improves" understates the remediation — while improving recall is the correct priority, faithfulness must be monitored independently after recall improvement to confirm that the generation failures were retrieval-driven.
Question 5. The Chapter 5 lesson states that RAGAS is fast and repeatable enough to run after every change to a pipeline. A team maintains a RAG system over a corporate knowledge base that is updated weekly with new policy documents. Prompt changes and model upgrades are deployed through a reviewed release process. Which event can change the system's answers without passing through that release process, and therefore most needs an automatic RAGAS run?
A. The LLM provider announces a new, more capable model version.
B. The weekly corpus update adds a large batch of documents containing significant revisions to existing policy content.
C. A developer proposes a change to the system prompt.
D. User session volume increases by 30% in a week.
Correct Answer: B
✅ B is correct. The corpus update arrives on a schedule and changes what the retriever can return without any code or prompt change being reviewed. When new documents revise existing policies, the vector store may hold both the old and new versions of the same policy. A query may then retrieve chunks from both versions, which lowers context precision and can lower faithfulness if the LLM merges conflicting versions into an answer neither supports. Because users may receive incorrect policy information before anyone notices, an evaluation run should be triggered automatically after each ingestion.
❌ A is incorrect as the best answer. A model upgrade also warrants a RAGAS run, since the lesson says to run it after every change. However, an upgrade is a deliberate change that the team chooses to adopt, so it can be evaluated as part of the release decision before users see it.
❌ C is incorrect. A prompt change is also a pipeline change that should be evaluated, but it is evaluated as part of the review and release process before it is deployed.
❌ D is incorrect. A rise in session volume does not change the pipeline. It increases the chance of encountering edge-case queries, which is a reason to review how well the test set covers real usage, and not a reason for an immediate run.
*Created: 09/30/2026 (C. Lizárraga)
2026.
Arizona Institute for Artificial Intelligence (AI2S).
Office of Responsible Artificial Intelligence. The University of Arizona.
AI Automation and Agents (v2)
Table of Contents
📂 Preparing your Portfolio in Github
MODULE 1
- 1.1 Module Overview
-
1.2 Foundational Concepts /
1.2 Addendum - 1.3. Module Activities
- 1.4. Additional Resources
Summary and Key Takeaways:
MODULE 2
- 2.1 Module Overview
-
2.2 Foundational Concepts /
2.2 Addendum - 2.3 Activities
- 2.4 Additional Resources
MODULE 3
- 3.1 Module Overview
-
3.2 Foundational Concepts /
3.2 Addendum - 3.3 Activities
- 3.4 Additional Resources
MODULE 4
MODULE 5