In the Retrieval-Augmented Generation (RAG) architecture, the Retriever plays a key role. What is its main purpose?
Think about which part searches for information before generating answers.
The Retriever's job is to search a large set of documents to find the most relevant pieces of information related to the input question. This helps the Generator produce better answers.
Given a batch of 2 queries, each retrieving 3 documents, and each embedding vector has size 768, what is the shape of the combined embeddings tensor before generation?
batch_size = 2 num_docs = 3 embedding_size = 768 # Assume embeddings shape is (batch_size, num_docs, embedding_size) embeddings_shape = (batch_size, num_docs, embedding_size) # Combined embeddings shape after flattening documents per query combined_shape = (batch_size, num_docs * embedding_size) print(combined_shape)
Multiply the number of documents by the embedding size for each query.
Each query has 3 documents, each with 768 features. Flattening the documents per query results in 3 * 768 = 2304 features per query. For 2 queries, shape is (2, 2304).
In the RAG architecture, which type of model is commonly used as the Generator to produce answers from retrieved documents?
Think about models designed for text generation with attention mechanisms.
The Generator in RAG is usually a sequence-to-sequence Transformer model such as BART or T5, which can generate fluent text conditioned on retrieved documents.
In RAG, you can adjust how many documents the Retriever returns for each query. What is this hyperparameter commonly called?
It relates to the count of documents fetched per query.
The hyperparameter controlling how many documents are retrieved per query is often named num_retrieved_docs or similar, defining the number of passages used for generation.
When testing a RAG model on open-domain question answering, which metric is most suitable to measure how well the generated answers match the correct ones?
Consider a metric that checks if the generated answer exactly matches the reference answer.
Exact Match (EM) score measures the percentage of generated answers that exactly match the ground truth answers, making it a standard metric for open-domain QA evaluation.