0
0
Prompt Engineering / GenAIml~20 mins

RAG architecture overview in Prompt Engineering / GenAI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RAG Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main purpose of the Retriever component in RAG?

In the Retrieval-Augmented Generation (RAG) architecture, the Retriever plays a key role. What is its main purpose?

ATo train the model using labeled data
BTo generate natural language text based on retrieved information
CTo find relevant documents or passages from a large knowledge base based on the input query
DTo evaluate the quality of generated answers
Attempts:
2 left
💡 Hint

Think about which part searches for information before generating answers.

Predict Output
intermediate
2:00remaining
What is the output shape of the combined embeddings in RAG?

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?

Prompt Engineering / GenAI
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)
A(2, 2304)
B(2, 3, 768)
C(6, 768)
D(2, 768)
Attempts:
2 left
💡 Hint

Multiply the number of documents by the embedding size for each query.

Model Choice
advanced
2:00remaining
Which model type is typically used as the Generator in RAG?

In the RAG architecture, which type of model is commonly used as the Generator to produce answers from retrieved documents?

ASequence-to-sequence Transformer model like BART or T5
BConvolutional Neural Network (CNN)
CRecurrent Neural Network (RNN) without attention
DFeedforward Neural Network
Attempts:
2 left
💡 Hint

Think about models designed for text generation with attention mechanisms.

Hyperparameter
advanced
2:00remaining
Which hyperparameter controls how many documents the Retriever fetches in RAG?

In RAG, you can adjust how many documents the Retriever returns for each query. What is this hyperparameter commonly called?

Aembedding_dim
Bbatch_size
Clearning_rate
Dnum_retrieved_docs
Attempts:
2 left
💡 Hint

It relates to the count of documents fetched per query.

Metrics
expert
3:00remaining
Which metric best evaluates the quality of answers generated by RAG on open-domain QA tasks?

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?

AMean Squared Error (MSE)
BExact Match (EM) score
CBLEU score
DAccuracy on classification labels
Attempts:
2 left
💡 Hint

Consider a metric that checks if the generated answer exactly matches the reference answer.