Questions
33 of 46
1What is RAG and why is it preferred over fine-tuning for domain-specific knowledge in production applications?
2What are the core components of a RAG pipeline in LangChain — Document Loaders, Text Splitters, Embeddings, Vector Stores, Retrievers, and Chains?
3What is the difference between semantic search and keyword search and why does RAG rely on semantic similarity?
4What is an Embedding in the context of RAG — what does it represent and why is cosine similarity used to compare them?
5What is a Vector Store and how does it differ from a traditional relational or document database?
6What is the difference between a Retriever and a Vector Store in LangChain — why is the abstraction separation important?
7What is a Document object in LangChain — what are pageContent and metadata fields and why does metadata matter in RAG?
8What are Document Loaders in LangChain and how do you choose the right loader for PDFs, web pages, Notion, Google Drive, or SQL databases?
9What is the difference between RecursiveCharacterTextSplitter and CharacterTextSplitter — when would you use one over the other?
10What is chunk size and chunk overlap in text splitting — how do you decide the right values for your use case?
11How do you handle structured documents like tables, code blocks, or markdown files during the splitting phase to avoid breaking semantic meaning?
12How do you load and split documents lazily (streaming) to handle very large files without running out of memory?
13What is a SemanticChunker and how does it differ from fixed-size character-based splitting?
14How do you preserve and propagate source metadata (filename, page number, URL, timestamp) through the loading and splitting pipeline?
15How do you choose the right embedding model — what tradeoffs exist between OpenAI embeddings, Cohere, HuggingFace, and local models like nomic-embed?
16What is the difference between dense embeddings and sparse embeddings (BM25) — when would you combine both in a hybrid search?
17How do you handle embedding model upgrades in production — what happens to your existing vectors when you switch models?
18How do you efficiently batch embed a large corpus of documents without hitting rate limits or memory constraints?
19What are the tradeoffs between vector stores like Pinecone, Weaviate, Chroma, pgvector, and FAISS — how do you choose for production?
20How do you implement namespace or tenant isolation in a vector store for a multi-tenant RAG application?
21How do you handle incremental updates to a vector store — adding, updating, and deleting documents without full re-indexing?
22What is HNSW indexing and why does it make approximate nearest neighbor search fast at scale?
23What is a similarity score threshold in retrieval and how do you use it to filter out low-confidence results?
24What is MMR (Maximal Marginal Relevance) retrieval and how does it balance relevance with diversity of results?
25What is a MultiQueryRetriever and how does it improve recall by generating multiple phrasings of the same question?
26What is Contextual Compression in LangChain retrieval and how does it reduce noise in retrieved chunks?
27What is a ParentDocumentRetriever — how does it index small chunks but return larger parent chunks to the LLM?
28What is HyDE (Hypothetical Document Embedding) and how does it improve retrieval for vague or abstract queries?
29What is Self-Query Retrieval and how does it allow the LLM to generate structured metadata filters alongside the semantic query?
30How do you implement hybrid search combining dense vector search with BM25 keyword search using EnsembleRetriever?
31What is a Re-ranker (cross-encoder) and where does it fit in the RAG pipeline after initial retrieval?
32What is the difference between Stuff, MapReduce, Refine, and MapRerank document chain strategies — when do you use each?
33How do you build a Conversational RAG chain that maintains chat history and reformulates follow-up questions into standalone queries?
34What is query decomposition and how do you break a complex multi-part question into sub-queries for better retrieval?
35How do you implement Step-Back Prompting in a RAG pipeline to improve retrieval for highly specific questions?
36What is CRAG (Corrective RAG) and how does it add a grading step to decide whether retrieved docs are relevant before answering?
37What is Self-RAG and how does the LLM decide when to retrieve, whether retrieved docs are relevant, and whether the answer is grounded?
38How do you implement a fallback strategy when retrieval returns no relevant documents — how do you avoid hallucination in this case?
39How do you implement RAG evaluation — what metrics like faithfulness, answer relevancy, and context recall do you measure using RAGAS?
40How do you detect and mitigate hallucination in RAG outputs — what role does citation and source grounding play?
41How do you build a citation system that maps each sentence in the LLM's answer back to the exact source chunk it came from?
42How do you handle multilingual RAG — embedding and retrieving documents in multiple languages for a global user base?
43How do you optimize retrieval latency in production — what caching, pre-fetching, or index optimization strategies do you apply?
44How do you implement access control at the retrieval layer — ensuring users only retrieve documents they are authorized to see?
45How do you handle long context RAG — when retrieved chunks exceed the LLM's context window, what strategies do you apply?
46How do you design a RAG pipeline with LangGraph — turning retrieval, grading, and generation into discrete stateful graph nodes?
33 / 46

How do you build a Conversational RAG chain that maintains chat history and reformulates follow-up questions into standalone queries?

Build a Conversational RAG chain using LangChain's create_history_aware_retriever and create_retrieval_chain, which reformulate follow-up questions into standalone queries using the chat history and then retrieve relevant documents to generate context-aware answers.

A Conversational RAG chain enhances basic RAG by maintaining chat history and reformulating follow-up questions into standalone queries. The process involves three steps: First, it uses a query-condensing prompt to convert the latest question and chat history into a self-contained query. Second, it retrieves relevant documents using this reformulated query. Third, it passes the retrieved documents and the full conversation history to the LLM to generate a coherent answer. LangChain provides create_history_aware_retriever for the reformulation step and create_retrieval_chain for the final QA.[reference:2][reference:3]

Implementing Conversational RAG Chain
Key Considerations
  1. 1

    Store chat history in a session-based database (e.g., Redis, PostgreSQL) for multi-turn conversations.

  2. 2

    Use a sliding window to keep only recent messages, preventing context window overflow.

  3. 3

    Limit the number of retrieved documents (e.g., k=3–5) to reduce noise and token usage.

  4. 4

    Implement a fallback for empty retrieval to avoid hallucination (e.g., "I don't have enough information to answer that.")

Difficulty: 7/10
Topics: Conversational RAG, Query Reformulation, LangChain LCEL

Scenario Questions

0-2 years experience
  1. 1

    We are building a basic customer support bot. If a user says 'What is my balance?' and then follows up with 'Can you export it?', the bot loses track of what 'it' refers to. How would you set up a LangChain chain to rewrite that second question into 'Can you export my balance?' before sending it to our retriever?

  2. 2

    Imagine you've set up a conversational RAG chain but notice that the chat history is getting passed to the LLM twice—once for rewriting and once for the final answer. How would you debug your chain's prompt templates to see exactly what text is being sent to the LLM at each step?

2-5 years experience
  1. 1

    We deployed a conversational RAG feature using LangChain's LCEL, but users are complaining about high latency. We realized the LLM is running a reformulation step on every single turn, even when the user just says 'thanks' or 'hello'. How would you modify the chain to conditionally bypass the reformulation step?

  2. 2

    Our team is migrating from the legacy ConversationalRetrievalChain to the modern LCEL-based history-aware retriever. During the migration, we're seeing that the chat history isn't persisting across API calls in our FastAPI backend. How would you integrate a persistent session-based chat history, like Redis, into this new LCEL chain?

5-8 years experience
  1. 1

    In our enterprise RAG pipeline, the query reformulation step occasionally hallucinates or strips out critical keywords like specific error codes, leading to poor document retrieval. How would you design an evaluation and guardrail strategy specifically for the query-rewriting component of your LangChain pipeline?

  2. 2

    We are scaling our conversational RAG system to handle thousands of concurrent users. The query reformulation step adds an extra LLM call, doubling our latency and token costs. What architectural patterns or LangChain optimizations would you implement to minimize this overhead without losing conversational context?

8+ years experience
  1. 1

    We have multiple product teams building different conversational agents across the company, each implementing their own ad-hoc history management and query reformulation. How would you design a centralized, reusable LangChain-based platform or middleware layer that standardizes stateful RAG, session management, and context condensation while allowing teams to plug in their own domain-specific retrievers?

  2. 2

    When designing a multi-turn conversational RAG system for a highly regulated domain like healthcare or finance, how do you architect the query reformulation and history pruning mechanisms to guarantee that sensitive PII is redacted before reformulation, and that the reformulated query doesn't inadvertently leak context across tenant boundaries?

Follow-up Questions

  • How do you handle token limit issues when the chat history grows too long for the reformulation prompt?
  • What latency optimization strategies would you apply to avoid making two sequential LLM calls per turn?
  • How would you unit test the query reformulation step independently of the vector database?