Retrieval-Augmented Generation (RAG) Questions

Grounding language-model outputs in external knowledge at inference time. Covers document ingestion, chunking and embedding, sparse, dense and hybrid retrieval (BM25, score fusion, contrastive training of retrievers), vector search and approximate-nearest-neighbour index engineering (HNSW, IVF, product quantization, filtering, updates, sharding), re-ranking with cross-encoders, and context assembly with prompt templates and citations. Also covers reducing hallucination through verification and abstention, evaluating retrieval-augmented systems, and production concerns such as freshness, access control, prompt injection through retrieved documents, deletion and privacy, caching, cost, and weighing retrieval against fine-tuning. Generic LLM evaluation and release gates, the craft of prompts beyond retrieved-context templates, attention internals, parameter-efficient fine-tuning, model serving and distributed inference engineering, database indexes, and whole-product ML system design are covered elsewhere.

MediumTechnical
24 practiced

You must pick an ANN library for a production retrieval service. Compare FAISS (flat and IVF-PQ variants), Annoy and an HNSW implementation such as hnswlib or nmslib on memory versus recall, build time, incremental update support, and CPU versus GPU options. Which fits which scenario?

HardTechnical
23 practiced

Explain product quantization for vector compression. How are vectors split into subspaces, how are codebooks trained with k-means per subspace, and how do compressed codes enable memory-efficient approximate nearest neighbor search and what accuracy is lost?

EasyTechnical
19 practiced

What is the difference between a retriever and a re-ranker in a RAG pipeline? Give an example where re-ranking is necessary and describe the cost trade-offs it introduces.

MediumTechnical
16 practiced

Compare retrieval-augmented generation and fine-tuning for adding domain knowledge to an LLM. When is each the better fit across cost, latency, freshness, privacy and maintainability?

MediumTechnical
17 practiced

Sketch a Python implementation of approximate similarity search over image embeddings using locality-sensitive hashing or an ANN library. Show how you precompute embeddings, build and update the index, run a query, and how the number of hash tables and hash size trade recall against query latency.

Unlock Full Question Bank

Get access to all 40 Retrieval-Augmented Generation (RAG) interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.