LearnThatStack Ace your next interview
AI Engineering
RAG (Retrieval-Augmented Generation).
Change topic Change
Practice · Questions

All questions

Showing of 55
Beginner 13
01

What is Retrieval-Augmented Generation, and what problem does it solve?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Retrieval-Augmented Generation (RAG) finds relevant information from an external collection and gives it to a language model before the model answers. It connects generated text to sources that the model did not memorize during training.

A typical system searches company documents, product manuals, or other approved data for the user's question. It places the best passages in the prompt and asks the model to answer from them.

RAG helps with private, detailed, and changing knowledge. It can also support citations and easier updates. It does not guarantee truth, because retrieval can miss the right passage and the model can still misunderstand or ignore good evidence.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

Why would a team choose RAG over simply relying on a frontier model's built-in knowledge?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

RAG supplies information that model weights may not contain, such as internal policies, customer records, or recent documentation. The team can update the knowledge source without retraining or waiting for a new model.

Retrieved passages provide evidence that can be cited and inspected. Access filters can also limit which documents each user may see. These controls are difficult when facts exist only inside a model's weights.

Built-in knowledge is still useful for general language and reasoning. Use RAG when the answer depends on private, current, or source-specific facts. Evaluate retrieval carefully, since adding irrelevant documents can make the final answer worse.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

Walk me through the canonical stages of a RAG pipeline.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A RAG pipeline has an ingestion path and a query path. During ingestion, it parses documents, splits them into useful chunks, creates embeddings, and stores text, vectors, metadata, and access rules.

During a query, it:

  1. Rewrites or expands the user's question when needed.
  2. Retrieves candidate chunks with vector, keyword, or hybrid search.
  3. Filters and reranks the candidates.
  4. Builds a prompt from the best evidence.
  5. Generates an answer with source references.

The application then validates citations, logs the stages, and collects feedback from real users. Each stage needs separate evaluation so a retrieval miss is not mistaken for a generation failure.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What is an embedding, and why is it central to RAG?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An embedding is a numeric vector that represents the meaning of text. Similar ideas tend to produce nearby vectors, even when they use different words.

For RAG, the system embeds document chunks during ingestion and stores their vectors. It embeds the user's question with the same model, compares that query vector with stored vectors, and returns nearby chunks. This enables semantic search across vocabulary differences.

Embeddings are central but not sufficient. They can miss exact names, numbers, or rare terms, so keyword search and reranking often help. The embedding model, chunking method, metadata, and evaluation data all affect retrieval quality.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

What is a vector database, and why not just compare the query against every stored vector?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A vector database stores embeddings with their source text and metadata, then supports fast similarity search. It also provides indexing, filtering, updates, deletion, replication, and operational controls.

Comparing a query with every vector gives exact nearest neighbors, but the work grows linearly with the collection. That can be too slow and expensive for millions of vectors or high query traffic.

Vector databases use approximate nearest neighbor indexes to examine a much smaller candidate set. This trades a little recall for large speed gains. Exact search is still reasonable for small collections, offline evaluation, or a final reranking step after filtering.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

Why do we chunk documents instead of embedding and retrieving whole documents?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Whole documents often contain several topics, so one embedding blurs their meaning. Retrieving the entire document also wastes context tokens and can hide the exact passage needed for an answer.

Chunking creates smaller units that are easier to match and fit into a prompt. Each chunk should carry metadata that connects it to the source, section, page, and access policy.

Chunks that are too small lose context; chunks that are too large reduce retrieval precision. Start with natural sections or paragraphs, then tune size and overlap on real questions. Preserve a way to expand around a winning chunk when neighboring text changes its meaning.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What is chunk overlap, and why is it commonly used?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Chunk overlap repeats some text at the boundary between neighboring chunks. It reduces the chance that a sentence, definition, or important relationship is split so neither chunk contains enough context.

Overlap can improve retrieval, but it increases embedding cost, storage, and duplicate results. Too much overlap may fill the final prompt with repeated evidence and reduce source diversity.

Use the smallest overlap that fixes measured boundary failures. Structural chunking may need less overlap because headings and paragraphs already create meaningful boundaries. Deduplicate or merge adjacent retrieved chunks before generation, and evaluate overlap with real queries rather than selecting a percentage by habit.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

How does dense retrieval differ from keyword search like BM25?

Part of Pro
09

What does top-k mean in retrieval, and how do you think about choosing k?

Part of Pro
10

What does grounding mean in the context of RAG, and how do citations typically work?

Part of Pro
11

RAG is often said to reduce hallucinations. Why does it help, and why does it not eliminate them?

Part of Pro
12

How is the final prompt constructed in a RAG system, and what belongs in it?

Part of Pro
13

Which similarity metric should you use for embeddings - cosine, dot product, or Euclidean - and when does normalization matter?

Part of Pro
Intermediate 20
14

Compare fixed-size, recursive, semantic, and structural chunking. When would you pick each?

Part of Pro
15

What are the tradeoffs between small chunks and large chunks?

Part of Pro
16

What is hybrid retrieval, and why does it usually outperform pure dense retrieval?

Part of Pro
17

Explain Reciprocal Rank Fusion. Why is it preferred over combining raw scores?

Part of Pro
18

What is a cross-encoder reranker, and why is it more accurate than the bi-encoder used for retrieval?

Part of Pro
19

Why do production systems use two-stage retrieval instead of one great model?

Part of Pro
20

In a multi-turn chat, why can't you embed the user's latest message directly, and what do you do instead?

Part of Pro
21

What are query expansion and query decomposition, and when does each help?

Part of Pro
22

Explain HyDE. What problem does it address and what are its risks?

Part of Pro
23

Define recall@k, MRR, and nDCG. When is each the right retrieval metric?

Part of Pro
24

How do you evaluate the generation side of RAG, in the style of frameworks like RAGAS?

Part of Pro
25

How would you build an evaluation dataset for a RAG system when none exists?

Part of Pro
26

What is the lost-in-the-middle problem, and how do you mitigate it in RAG?

Part of Pro
27

A user reports the assistant said "I couldn't find anything" but the document exists in the corpus. How do you debug this retrieval miss?

Part of Pro
28

How does metadata filtering work in vector search, and what is the difference between pre-filtering and post-filtering?

Part of Pro
29

What factors matter when choosing an embedding model for RAG?

Part of Pro
30

Compare HNSW and IVF indexes, and explain where quantization fits in.

Part of Pro
31

When should you use RAG versus fine-tuning versus just using a long context window?

Part of Pro
32

How do you route a query across multiple knowledge sources, and how do you decide not to retrieve at all?

Part of Pro
33

What is parent-document (small-to-big) retrieval, and how does it differ from just using larger chunks?

Part of Pro
Expert 22
34

What is contextual retrieval (contextual chunk enrichment), and what failure of naive chunking does it fix?

Part of Pro
35

What is GraphRAG, and when is it worth the added complexity?

Part of Pro
36

What makes a RAG system "agentic," and what does that buy you over a fixed pipeline?

Part of Pro
37

How do you handle multi-hop questions in RAG?

Part of Pro
38

Explain Self-RAG and Corrective RAG. What production patterns did they inspire?

Part of Pro
39

How do you detect and prevent hallucinated citations in RAG outputs?

Part of Pro
40

How do you keep a RAG index fresh as documents are created, edited, and deleted?

Part of Pro
41

How do you implement multi-tenancy and document-level access control in RAG retrieval?

Part of Pro
42

Walk through the latency budget of a production RAG query. Where does time go and how do you optimize?

Part of Pro
43

What caching strategies apply to RAG, and what are the invalidation pitfalls?

Part of Pro
44

How do you handle tables, images, and other non-prose content in a RAG corpus?

Part of Pro
45

Compare cross-encoder rerankers with LLM-based rerankers. How would you choose?

Part of Pro
46

Your embedding model is being deprecated. How do you migrate a large production index without downtime or quality regression?

Part of Pro
47

How do you assemble the final context when many chunks survive reranking? Discuss ordering, deduplication, and token budgeting.

Part of Pro
48

Design the evaluation program for a RAG product from prototype to production. What do you measure, when, and how do you keep the metrics trustworthy?

Part of Pro
49

Your dashboards show retrieval recall is high, yet users report wrong answers. Walk through your systematic diagnosis.

Part of Pro
50

Design retrieval for a corpus of 100M+ documents with strict latency SLOs. What changes relative to a small-scale RAG stack?

Part of Pro
51

What security threats are specific to RAG systems, and how do you mitigate them?

Part of Pro
52

Build the economic decision framework: when does RAG lose to long-context stuffing or fine-tuning? Include the cost math.

Part of Pro
53

Design a RAG system for a high-stakes domain (legal or medical) where wrong answers carry liability. What changes relative to a standard assistant?

Part of Pro
54

How do you do RAG over structured data such as SQL tables or APIs instead of documents?

Part of Pro
55

When are learned sparse retrieval (SPLADE) or late-interaction models (ColBERT) worth using instead of a dense plus BM25 hybrid?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for RAG (Retrieval-Augmented Generation)? Send them this set.
Pro · $10/mo

48 of 55 RAG (Retrieval-Augmented Generation) answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git