passdrill

RAG & Embeddings

12 cards · AI & LLM Engineering · answer each one, then read the explanation. Your score tallies below.

0 / 12 answered · 0 correct
AI & LLM Engineering · RAG & Embeddings · Card 001/012 easy

A team wants a support chatbot to answer questions about an internal policy document set that changes weekly. Instead of periodically fine-tuning the model on the updated documents, they build a system that retrieves the most relevant passages from a continuously re-indexed document store and inserts them into the prompt before the model generates its answer. What is the main advantage of this retrieval-augmented approach over repeatedly fine-tuning on the updated documents?

  1. The knowledge base can be kept current by re-indexing the changed documents alone, without retraining or replacing the model's weights, so newly added or edited information becomes available to the chatbot as soon as it is indexed
  2. Fine-tuning is incapable of teaching a model any new factual content, so repeating it on the updated documents would have no effect on the chatbot's answers at all
  3. Retrieval-augmented generation removes the model's context window limit entirely, so an unlimited number of documents can be inserted into every prompt
  4. The passages retrieved from the document store are automatically checked for factual accuracy before being shown to the model, which guarantees the chatbot's answers will never contain unsupported claims
AI & LLM Engineering · RAG & Embeddings · Card 002/012 easy

A team splits long internal manuals into fixed-size chunks before embedding them for a retrieval index, and configures each chunk to overlap with the next by roughly 10-20% of its length rather than starting exactly where the previous chunk ended. What is the main reason for using this overlap between adjacent chunks?

  1. It reduces the total number of chunks that must be embedded and stored, which lowers the cost of building the index
  2. It prevents a sentence or idea that spans a chunk boundary from being split apart so that neither resulting chunk contains it in full, which could leave either chunk incoherent or missing context on its own
  3. It guarantees that every chunk containing the overlapping text will be retrieved for any query relevant to that document, since duplicated content is matched more often
  4. It lets the embedding model process shorter chunks than the maximum input length it is otherwise capable of handling
AI & LLM Engineering · RAG & Embeddings · Card 003/012 easy

An embedding model converts each passage of text into a fixed-length vector of numbers such that passages with related meaning end up close together in that vector space, even when they don't share any of the same words. Which retrieval technique exploits this property to find passages relevant to a user's query?

  1. Exact string matching between the characters of the query and the characters of the document text
  2. Regular-expression pattern matching against a fixed set of predefined query templates
  3. Nearest-neighbor search, which embeds the query with the same embedding model and retrieves the passages whose vectors are closest to the query's vector
  4. Sorting every document by its publication date and returning the most recently added ones, regardless of their content
AI & LLM Engineering · RAG & Embeddings · Card 004/012 easy

A retrieval system ranks documents by comparing a query vector against every document vector using cosine similarity, rather than the raw, unnormalized dot product between them. What property makes cosine similarity attractive for this purpose?

  1. It is always computationally faster than the dot product or Euclidean distance, no matter how large the vectors are
  2. It converts every embedding into a binary vector first, which speeds up the comparison using bitwise operations
  3. It only works correctly when every vector in the index has exactly the same number of dimensions as every other vector
  4. It measures the angle between two vectors rather than their length, so two embeddings pointing in the same direction score as highly similar even if one vector happens to have a larger magnitude than the other
AI & LLM Engineering · RAG & Embeddings · Card 005/012 easy

A vector index built with the HNSW algorithm returns the top-k most similar vectors to a query in a few milliseconds even when the index holds tens of millions of vectors, but occasionally misses a vector that an exhaustive, compare-against-everything search would have found. What best explains this trade-off?

  1. HNSW is an approximate nearest-neighbor algorithm: it searches a multi-layer navigable graph structure to reach a good answer quickly, accepting a small chance of missing the true nearest neighbor in exchange for search times far faster than comparing the query against every stored vector
  2. HNSW deletes any vector it judges to be a near-duplicate of another vector already in the index, so the missed vector was likely removed while the index was being built
  3. HNSW indexes only a random sample of the uploaded vectors and ignores the rest, so vectors outside that sample can never be returned by any query
  4. HNSW rounds every vector's coordinates to a lower numeric precision before storing them, and the missed vector's true nearest neighbor was lost during that rounding step
AI & LLM Engineering · RAG & Embeddings · Card 006/012 easy

A support-ticket search system built purely on dense embedding similarity performs poorly when a user searches for an exact error code like 'ERR-4471', because the embedding model treats the code as similar to other short alphanumeric strings rather than as a specific identifier that must match exactly. Which change would most directly address this particular weakness?

  1. Retrain the embedding model on a larger general-purpose text corpus so that it becomes more accurate at every kind of query
  2. Add a sparse, keyword-based retrieval method such as BM25 alongside the dense embedding search, and combine both rankings into a single hybrid result set, since exact-term matching methods are specifically strong at the rare-token, exact-identifier queries where dense embeddings tend to struggle
  3. Increase the number of dimensions in the embedding vectors so the model can represent more information about each ticket
  4. Reduce the size of the text chunks so that each error code ends up stored as its own, isolated chunk
AI & LLM Engineering · RAG & Embeddings · Card 007/012 medium

A RAG pipeline's first stage retrieves the 50 candidate passages whose embeddings are closest to the query, using a bi-encoder that embeds the query and each passage independently and compares the two embeddings afterward. Before generation, a second-stage model re-scores those 50 candidates by feeding the query and each passage together into a single transformer that outputs one relevance score per pair. Why is this second-stage model typically applied only to a shortlist rather than to the entire document collection?

  1. It cannot process any text that has already been converted into an embedding vector, so it can only ever run before an embedding index exists
  2. It produces scores that are only meaningful when compared against a bi-encoder's scores, so by definition it must always run after the bi-encoder stage
  3. Scoring a query together with a passage in a single joint pass is far more computationally expensive per pair than comparing two independently pre-computed embeddings, so running it against every document in a large collection would be too slow; restricting it to a small shortlist keeps the added latency manageable while still improving ranking accuracy where it matters most
  4. It can only ever reproduce the same ranking the first-stage retrieval already produced, so applying it to the full collection would be redundant
AI & LLM Engineering · RAG & Embeddings · Card 008/012 medium

A RAG system retrieves 8 relevant passages for a query and inserts all of them into a single long prompt in an arbitrary order before generation. Research studying how language models use long contexts documented a failure mode directly relevant here. What is that failure mode, and what does it suggest about how the 8 passages should be arranged in the prompt?

  1. Models cannot process context windows longer than a few thousand tokens at all, so several of the 8 passages would simply be truncated and never reach the model regardless of their order
  2. Models weight every position in the context equally when generating an answer, so the order in which the 8 passages appear has no measurable effect on the result
  3. Models process the context strictly from the last token backward, so only the very last of the 8 passages in the prompt has any influence on the generated answer
  4. Performance on tasks that require using information from within a long context follows a U-shaped curve, staying strongest for information near the very beginning or the very end of the context and degrading for information placed in the middle, so the most relevant of the 8 passages should be placed near the start or end of the prompt rather than buried in the middle
AI & LLM Engineering · RAG & Embeddings · Card 009/012 medium

A retrieval system is evaluated on a query for which there are 10 truly relevant passages somewhere in the corpus. The system returns 20 passages for that query, and 8 of those 20 are among the 10 truly relevant passages. What are this query's recall@20 and precision@20?

  1. Recall@20 = 8/10 = 0.8, because 8 of the 10 relevant passages were retrieved; precision@20 = 8/20 = 0.4, because only 8 of the 20 returned passages were relevant
  2. Recall@20 = 8/20 = 0.4, because 8 of the 20 returned passages were relevant; precision@20 = 8/10 = 0.8, because 8 of the 10 relevant passages were retrieved
  3. Recall@20 and precision@20 are both 8/18 = 0.44, since the two missed relevant passages and the twelve irrelevant returned passages should be pooled into a single combined denominator
  4. Recall@20 cannot be computed from the numbers given because it requires knowing the total size of the corpus, whereas precision@20 can be computed and equals 8/20 = 0.4
AI & LLM Engineering · RAG & Embeddings · Card 010/012 medium

A RAG evaluation reports high context recall, meaning the retrieved passages contain essentially all the information needed to answer the question, but low faithfulness, meaning much of the generated answer is not actually supported by those retrieved passages. What does this particular combination of scores most directly indicate is going wrong?

  1. The retrieval component failed to find the relevant passages, so the retrieved context is missing key information the answer needed
  2. The retrieval component is doing its job, since the needed information was present in what was retrieved, but the generation step is not staying grounded in that retrieved context and is producing claims the context does not actually support
  3. The embedding model used for retrieval is outdated and should be replaced with a newer one in order to fix the low faithfulness score
  4. Context recall and faithfulness measure the same underlying property from two different angles, so a high score on one should always produce a high score on the other
AI & LLM Engineering · RAG & Embeddings · Card 011/012 hard

A user asks a RAG-based support bot 'my payment keeps bouncing,' but the underlying documents describe the same problem using the phrase 'transaction declined by issuing bank.' A dense-embedding search using the literal query text sometimes misses these documents because of this vocabulary mismatch. A technique called HyDE (Hypothetical Document Embeddings) was designed to address exactly this kind of mismatch. How does it work?

  1. It expands the query by appending every synonym of each query word found in a static thesaurus, then searches using the combined, longer query text
  2. It retrains the embedding model on the specific vocabulary of the document collection immediately before each individual query is issued
  3. It prompts a language model to generate a hypothetical answer to the query first, then embeds that generated hypothetical answer, rather than the original query, and uses that embedding to search the index, on the theory that a plausible answer is likely to use vocabulary closer to the real documents than the short original query does
  4. It translates the query into several other languages and searches the index once per language before merging all of the results together
AI & LLM Engineering · RAG & Embeddings · Card 012/012 hard

A vector index supports post-filtering: for a query with a metadata filter such as department = 'legal', it first runs an approximate nearest-neighbor search to find the top-k candidates by similarity alone, and only afterward discards any of those candidates whose metadata does not match the filter. For a query whose filter matches only a tiny fraction of the total documents, this approach can return far fewer than k results even though plenty of matching documents exist elsewhere in the index. What causes this shortfall, and what is the general alternative that avoids it?

  1. The approximate nearest-neighbor search itself is broken, so the fix is to replace it with an exact, brute-force search that still applies the filter only after retrieving its top-k results
  2. The vector embeddings are miscalibrated for filtered fields, so the fix is to embed each document's metadata directly into the same vector used for its semantic content
  3. This is expected behavior with no available fix, so applications should only ever use filters broad enough to match at least half of the index
  4. Because the similarity search collects only a fixed-size pool of top-k candidates before any filtering happens, a filter that matches only a sparse subset of the index causes most of that fixed pool to be discarded, leaving too few results; pre-filtering avoids this by restricting the candidate set to metadata-matching vectors before or during the similarity search itself, so the search only ever ranks documents that could pass the filter in the first place