LLM Apps and RAG
Test what you know about building LLM applications: RAG, chunking, embeddings and vector search, hybrid search and reranking, structured output, latency and cost.
Question 1 of 15
Question 1
What problem does retrieval-augmented generation (RAG) mainly solve?
Not this time. RAG fetches relevant passages from your own documents and puts them in the prompt, so the model can answer from facts it was never trained on or that change often, and cite them.
Question 2
Users ask about error code "TS-999" and vector search returns passages about other error codes. What helps most?
Not this time. Embeddings capture meaning, not exact strings. Keyword search (BM25) matches the exact code. Hybrid search runs both and merges them, for example with reciprocal rank fusion.
Question 3
In reciprocal rank fusion, what decides a document's merged score?
Not this time. RRF ignores raw scores and adds up 1/(k + rank) over each result list, with k = 60 by default in Elasticsearch. Documents ranked high in several lists win.
Question 4
What does a reranker do in a RAG pipeline?
Not this time. A reranker scores each retrieved candidate together with the question (a cross-encoder or rerank API) and reorders them, so the best few go into the prompt. It is too slow to run over the whole index, so it runs on the top results.
Question 5
In pgvector, how does an HNSW index compare with IVFFlat?
Not this time. pgvector's documentation says HNSW has a better speed-recall trade-off but builds more slowly and uses more memory, and it needs no training step, so it can be created on an empty table. IVFFlat builds faster with less memory but should be built after the data is loaded.
Question 6
A RAG system answers wrongly. The logs show the right passage was never retrieved. Where is the fault?
Not this time. If the needed passage never reached the prompt, no prompt change can fix it. The fault is in retrieval: parsing, chunking, search method, query wording or filters.
Question 7
Liu et al.'s "Lost in the Middle" study found that language models…
Not this time. They found accuracy was highest when the relevant information was at the start or end of the context and dropped when it was in the middle, even for long-context models. Put the best passages first.
Question 8
What does structured output with a JSON schema (constrained decoding) guarantee, and what does it not?
Not this time. It guarantees the response parses and matches the schema's shape. It does not make the values correct, and a refusal or hitting max_tokens can still produce non-matching output, so code still validates values.
Question 9
Which change makes a chat answer feel fastest to the user, without shortening total generation time?
Not this time. Streaming sends tokens as they are generated, so users see the answer begin almost at once. Time to first token is what they feel.
Question 10
Nightly, you classify 200,000 support tickets; results are needed by morning. What cuts the cost most simply?
Not this time. Work that does not need an immediate answer suits a batch API. Anthropic's Message Batches API costs 50% less, and most batches finish within an hour.
Question 11
To get prompt caching to work, where should a timestamp that changes on every request go?
Not this time. The cache only reuses an identical prefix. Anything that changes every request belongs after the cached part, near the end of the request, or the cache never hits.
Question 12
A user asks a RAG chatbot "and what about the second one?". What should happen before retrieval?
Not this time. Rewrite the follow-up into a standalone query using the conversation, so the search contains the missing subject. Search with the raw follow-up finds the wrong passages.
Question 13
What did the MTEB benchmark find about text embedding models?
Not this time. MTEB tested many models on 8 kinds of task and many datasets and languages, and found that no single method was best everywhere. That is why you test candidates on your own data.
Question 14
The API returns 429 with a retry-after header. What should the client do?
Not this time. A 429 means a rate limit was exceeded. Wait at least as long as retry-after says, then retry, with backoff and a cap on attempts. A 429 caused by a spend limit has no retry-after and will not succeed on retry.
Question 15
In a text-to-SQL feature, which control most directly stops a model-written query from deleting data?
Not this time. Run model-written SQL with a read-only database role limited to approved tables. Prompts can be bypassed; database permissions cannot.
Sources
Where each fact comes from
- 1Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
- 2Introducing Contextual Retrieval
- 3pgvector
- 4Reciprocal rank fusion
- 5Lost in the Middle: How Language Models Use Long Contexts
- 6Structured outputs
- 7Batch processing
- 8Reducing latency
- 9Prompt caching
- 10MTEB: Massive Text Embedding Benchmark
- 11Rate limits
- 12LLM05:2025 Improper Output Handling