Skill 3.1.8: Apply Retrieval Augmented Generation (RAG) system configurations (for example, retrieval strategies, reranking)
| Question | Answer & Explanation |
|---|---|
| ### Question 1 - Fixing Retrieval Ordering with Reranking An AI engineer is configuring an Amazon Bedrock Knowledge Base for a legal firm. The firm's lawyers report that while the Knowledge Base often retrieves the correct legal precedent, it appears lower in the returned context, while weaker, less relevant cases appear at the top. The constraints require improving the ordering of already-retrieved passages with the least operational overhead, without changing the underlying vector embeddings or re-indexing the documents. Which configuration directly addresses this ordering problem? (Select ONE) - A) Add a reranking model to reorder the retrieved candidates. - B) Reduce the number of returned passages ( top-k).- C) Switch the vector store to a different service. - D) Re-embed the documents with a higher dimension count. |
Correct Answer: A Correct Answer Analysis: - A is Correct: A reranking model (such as a cross-encoder) takes the query and the retrieved candidates and performs a deeper semantic relevance scoring, reordering the list so the most contextually accurate passages move to the top before passing to the LLM. This is a native Bedrock Knowledge Base configuration requiring minimal overhead. Distractor Analysis: - B is Incorrect: If the correct passage is currently ranked low, reducing top-k (e.g., from 10 to 5) would completely drop the correct passage from the retrieved set.- C is Incorrect: The vector database vendor executes nearest-neighbor searches based on distance metrics; changing stores does not change the inherent limitations of the bi-encoder vector search that caused the poor ranking. - D is Incorrect: Re-embedding requires a costly full re-indexing of the knowledge base, violating the operational constraint, and still may not fix complex query-document alignment as effectively as a cross-encoder. > Exam Tip: Reranking fixes precision/ordering of already retrieved passages; it does not improve recall (finding missing passages). |
| ### Question 2 - Implementing Hybrid Search for Exact Terms A retail company is using an Amazon Bedrock Knowledge Base backed by Amazon OpenSearch Serverless. Users complain that exact product SKU numbers and specific brand names are frequently missed in the search results, even though the semantic meaning of their queries is correct. The architecture must maintain low latency and use native Bedrock Knowledge Base configurations to resolve this issue without writing custom AWS Lambda code. Which strategy should the engineer apply? (Select ONE) - A) Enable hybrid search in the knowledge base configuration. - B) Deploy a custom SageMaker JumpStart cross-encoder model. - C) Apply metadata filtering to restrict results by brand. - D) Increase the embedding model's dimension count. |
Correct Answer: A Correct Answer Analysis: - A is Correct: Hybrid search combines vector (semantic) search with keyword (text) search. This recovers exact terms (like SKUs or specific brand names) that pure semantic embeddings often blur, and it is natively supported in Bedrock Knowledge Bases with OpenSearch Serverless. Distractor Analysis: - B is Incorrect: A cross-encoder reranks retrieved passages but does not address the initial failure to retrieve passages containing exact keyword matches. - C is Incorrect: While metadata filtering can restrict results, it is used for pre-filtering by attributes, not for matching exact keywords within the unstructured text of the documents. - D is Incorrect: Increasing dimensions increases embedding expressiveness but does not guarantee exact term matching. It also requires a full re-indexing of the data. > Exam Tip: Use hybrid search when exact keyword matches (SKUs, codes, names) must be combined with semantic understanding. |
| ### Question 3 - Excluding Stale Data with Metadata Filtering A financial services firm operates a RAG application using Amazon Bedrock Knowledge Bases. The knowledge base contains years of quarterly earnings reports. Analysts report that older, outdated reports from 2018 are frequently being retrieved and confusing the LLM, even when the query asks for current guidance. The solution must exclude these outdated documents before the similarity search is executed, minimizing compute overhead during retrieval. Which configuration achieves this? (Select ONE) - A) Apply metadata filtering to restrict searches to the current year. - B) Add a reranking model to push older reports down the list. - C) Increase the chunk size to include more recent context. - D) Enable query decomposition to break down the query. |
Correct Answer: A Correct Answer Analysis: - A is Correct: Metadata filters cut the candidate set before similarity is considered at all. By filtering on a "year" metadata attribute, outdated documents are excluded from the vector search, ensuring they never enter the retrieval pipeline or consume compute resources. Distractor Analysis: - B is Incorrect: A reranking model reorders the top-k retrieved passages, but the 2018 reports are still retrieved and processed by the vector search, wasting compute overhead and potentially pushing out relevant recent documents. - C is Incorrect: Changing chunk size alters how documents are parsed but does not filter out documents based on their creation date. - D is Incorrect: Query decomposition breaks a compound query into sub-queries to improve topic retrieval; it does not filter documents by metadata attributes like date. > Exam Tip: Metadata filtering is the right tool when stale or out-of-scope documents keep surfacing, as it filters before similarity search. |
| ### Question 4 - Handling Complex Queries with Query Decomposition A healthcare research team is querying a Bedrock Knowledge Base with complex questions like "What are the side effects of Drug X, and how do they compare to Drug Y for treating Condition Z?". The retrieval system returns mixed results that partially address the query but miss specific details about Drug Y and Condition Z. The least operational overhead solution must accurately retrieve context for all parts of the compound query. Which retrieval strategy should be applied? (Select ONE) - A) Enable query decomposition. - B) Switch from cosine similarity to Euclidean distance. - C) Increase the number of returned passages to 100. - D) Provision a custom Amazon OpenSearch Service cluster. |
Correct Answer: A Correct Answer Analysis: - A is Correct: Query decomposition breaks a compound question into sub-questions (e.g., "Side effects of Drug X", "Drug Y for Condition Z"). Each sub-query retrieves against its own topic, ensuring all aspects of the complex query are addressed before the context is combined for the LLM. Distractor Analysis: - B is Incorrect: Changing distance metrics (cosine to Euclidean) does not change the fundamental limitation that a single embedded query vector cannot accurately capture the semantic meaning of multiple distinct topics simultaneously. - C is Incorrect: Increasing top-k to 100 might accidentally retrieve some relevant passages for Drug Y, but it introduces massive noise, degrading LLM performance and increasing costs.- D is Incorrect: Provisioning a custom OpenSearch cluster introduces heavy operational overhead, which violates the constraint. > Exam Tip: Use query decomposition for multi-part, compound questions to ensure each topic retrieves its own relevant context. |
| ### Question 5 - Increasing Recall for Missing Passages An e-commerce platform uses Amazon Bedrock Knowledge Bases for product Q&A. The system currently retrieves the top 5 passages, but the LLM frequently states it doesn't have enough information to answer. The engineering team determines that the correct information exists in the 6th to 10th passages of the vector search. The solution must be implemented via native Bedrock configurations to ensure the LLM has more context. What configuration change directly solves this issue? (Select ONE) - A) Increase the number of returned passages ( top-k).- B) Decrease the number of returned passages ( top-k).- C) Add a reranking model to the knowledge base. - D) Enable hybrid search. |
Correct Answer: A Correct Answer Analysis: - A is Correct: Raising the number of returned passages widens recall and gives the model more context to work with. If the correct passage is ranked 6th or higher, increasing top-k ensures it is included in the context window passed to the LLM.Distractor Analysis: - B is Incorrect: Decreasing top-k would further restrict the context, making it even less likely the correct passage is retrieved.- C is Incorrect: A reranking model improves the ordering of already retrieved passages. If the correct passage is ranked 6th and top-k is 5, the reranker never sees it, so it cannot rescue the missing passage.- D is Incorrect: Hybrid search is used for exact keyword matching, not specifically for widening the general recall of semantically related passages that are slightly lower in the ranking. > Exam Tip: If the correct document is missed entirely (low recall), increase top-k. If the correct document is retrieved but ranked low (low precision), use a reranker. |
| ### Question 6 - Choosing a Managed Reranking Model A logistics company is building a RAG system with Amazon Bedrock Knowledge Bases. They want to improve the precision of their retrieved documents. They have already configured the knowledge base to return 20 passages. They need to reorder these 20 passages so the most relevant ones are passed to the LLM first, using an AWS-native, fully managed cross-encoder model with the least operational overhead. Which approach should they use for the reranking step? (Select ONE) - A) Enable a Bedrock Reranking model (e.g., Amazon Rerank) in the Knowledge Base configuration. - B) Deploy a custom SageMaker Real-Time Endpoint hosting a HuggingFace cross-encoder. - C) Write an AWS Lambda function to invoke an external reranking API. - D) Use Amazon Comprehend custom classification to classify the passages. |
Correct Answer: A Correct Answer Analysis: - A is Correct: Amazon Bedrock natively supports reranking models (such as Amazon Rerank) within the Knowledge Base configuration. This allows the system to automatically apply a cross-encoder to the retrieved passages without requiring custom infrastructure or code, perfectly meeting the operational overhead constraint. Distractor Analysis: - B is Incorrect: Deploying a custom SageMaker Real-Time Endpoint introduces significant operational overhead (instance management, scaling, monitoring) compared to native Bedrock reranking. - C is Incorrect: Writing custom Lambda code to call an external API violates the least operational overhead constraint and introduces network latency and external dependencies. - D is Incorrect: Amazon Comprehend is a natural language processing (NLP) service for sentiment analysis, entity recognition, and classification, not a cross-encoder reranker for RAG retrieval. > Exam Tip: For Bedrock Knowledge Bases, always prefer native features (like Bedrock Rerank) over custom infrastructure to minimize operational overhead. |
| ### Question 7 - Multi-Tenant Data Isolation in RAG A multinational corporation operates a multi-tenant RAG architecture using Amazon Bedrock Knowledge Bases. Tenant A must strictly be prevented from retrieving Tenant B's proprietary documents. The architecture must guarantee zero cross-tenant data leakage at the retrieval stage with the lowest operational overhead, without relying on the LLM to filter the context. Which configuration satisfies these requirements? (Select ONE) - A) Use metadata filtering with a tenant ID attribute in the Bedrock Knowledge Base query. - B) Provision a completely separate Bedrock Foundation Model for every tenant. - C) Add a reranking model to assign low scores to other tenants' documents. - D) Rely on Bedrock Guardrails to block cross-tenant content in the LLM response. |
Correct Answer: A Correct Answer Analysis: - A is Correct: Using metadata filtering with a strict tenant_id constraint ensures that the vector database only evaluates similarity among documents belonging to that specific tenant. This enforces data isolation before the context is retrieved, guaranteeing zero leakage at the retrieval layer with minimal overhead.Distractor Analysis: - B is Incorrect: Provisioning separate foundation models for each tenant does nothing to separate the knowledge base/vector store where the documents actually reside, and it is highly inefficient. - C is Incorrect: A reranking model reorders passages but still allows the other tenants' documents to be retrieved into the candidate pool, posing a leakage risk if top-k includes them.- D is Incorrect: Relying on Bedrock Guardrails or the LLM to filter content post-retrieval violates the constraint of guaranteeing isolation at the retrieval stage and increases compute costs. > Exam Tip: For multi-tenant RAG architectures, enforce data isolation using metadata filters at the vector search level, never relying on the LLM or post-generation guardrails. |
| ### Question 8 - Enabling Hybrid Search in OpenSearch Serverless A software development team is using Amazon Bedrock Knowledge Bases to search through their API documentation. They notice that when searching for exact function names like StartIngestionJob, the semantic search struggles to match the exact string, returning general ingestion documentation instead. The vector store is Amazon OpenSearch Serverless configured for semantic search only. The team needs to implement a solution that combines semantic understanding with exact keyword matching using the least engineering effort.Which configuration change resolves this? (Select ONE) - A) Enable Hybrid Search in the Bedrock Knowledge Base retrieval configuration. - B) Manually pre-process user queries in a Lambda function to append "exact match" tags. - C) Change the embedding model from Amazon Titan to Cohere Embed. - D) Deploy a real-time SageMaker endpoint alongside the knowledge base. |
Correct Answer: A Correct Answer Analysis: - A is Correct: Amazon OpenSearch Serverless supports hybrid search, which combines vector search (semantic) with keyword/text search. Enabling this natively in the Bedrock Knowledge Base configuration ensures exact function names are matched via text search while general concepts are matched via vector search. Distractor Analysis: - B is Incorrect: Manually pre-processing queries in Lambda introduces unnecessary operational overhead and custom code, violating the least engineering effort constraint. - C is Incorrect: Changing the embedding model might change the semantic vectors, but it does not explicitly enable exact keyword matching for specific function names. - D is Incorrect: Deploying a SageMaker endpoint is irrelevant to the vector search configuration inside the Bedrock Knowledge Base. > Exam Tip: Hybrid search requires a vector store that supports text fields (like OpenSearch Serverless) to combine keyword and semantic matches natively. |
| ### Question 9 - Reranker Limitations on Unretrieved Passages An AI engineer is troubleshooting an Amazon Bedrock Knowledge Base. Users report that the correct document is NEVER retrieved in the top 50 results for highly technical queries. The engineer adds a reranking model to the knowledge base configuration. After testing, the correct document is still not appearing in the results. The requirement is to improve recall for these specific queries. What is the root cause of the failure, and what should the engineer do instead? (Select ONE) - A) A reranking model only reorders already retrieved candidates; the engineer must increase top-k or improve the embedding model.- B) The reranking model is not powerful enough; the engineer must switch to a larger reranking model. - C) The vector store is failing; the engineer must enable hybrid search to fix the reranker. - D) Query decomposition is interfering with the reranker, and it must be disabled. |
Correct Answer: A Correct Answer Analysis: - A is Correct: A reranker is a second pass that reorders the candidates the vector search already found. It cannot rescue a passage that the first pass (vector search) never retrieved. To fix recall, the engineer must widen the net (increase top-k) or change the embedding model to better capture the technical semantics.Distractor Analysis: - B is Incorrect: Even the most powerful reranker can only score passages it receives as input. If the correct passage is not in the initial retrieved set, it will never be ranked. - C is Incorrect: Enabling hybrid search fixes exact keyword matching issues, not reranker failures. The issue here is that the correct document is not being retrieved at all by the bi-encoder. - D is Incorrect: Query decomposition and reranking can work together; it is not the cause of the passage being entirely missed in the initial retrieval. > Exam Tip: Remember: Rerankers improve precision (ordering), not recall (finding missing items). They operate only on the results returned by the initial vector search. |
| ### Question 10 - Optimizing LLM Context and Cost with Reranking A news agency uses Amazon Bedrock Knowledge Bases to query a massive archive of articles. To reduce the LLM context window cost and improve latency, the team needs to retrieve a small, highly precise set of articles. They currently use a high top-k setting (50) and pass all 50 passages to the LLM without reranking. The team must optimize the pipeline to ensure only the most relevant snippets are passed to the LLM, using native Bedrock configurations.Which architectural change meets these requirements? (Select ONE) - A) Keep top-k at 50, configure a reranking model, and pass only the top 5 reranked results to the LLM.- B) Decrease top-k to 5 and remove the reranking model.- C) Increase top-k to 100 to ensure the right passage is retrieved.- D) Switch to Amazon SageMaker Batch Transform for inference. |
Correct Answer: A Correct Answer Analysis: - A is Correct: By maintaining a high top-k (50) for the initial vector search, the system ensures high recall (the correct passage is likely caught). The reranker then evaluates all 50, and passing only the top 5 to the LLM drastically reduces the context window size, lowering cost and improving LLM latency/precision.Distractor Analysis: - B is Incorrect: Decreasing top-k to 5 without a reranker risks missing the correct passage entirely, as the initial vector search may not rank it in the top 5.- C is Incorrect: Increasing top-k to 100 and passing all to the LLM exponentially increases inference costs and context window bloat, violating the cost optimization constraint.- D is Incorrect: SageMaker Batch Transform is for offline bulk processing of static datasets, not for interactive RAG pipelines requiring real-time retrieval and generation. > Exam Tip: A two-stage retrieval architecture (high top-k retrieval + reranking to low top-k generation) is the standard pattern for optimizing RAG cost, latency, and precision. |