Reranking Bedrock Knowledge Base Results for Legal Precedents

Design retrieval mechanisms for FM augmentation. Optimize application performance.
Answer Correct answer: B — Enable reranking on the knowledge base with a reranker model, retrieve 50 documents, and return only the top 10 highest-scored documents to fit the context window within 3 seconds.

A legal research company is developing an AI-powered chat assistant that uses Amazon Bedrock with a knowledge base that contains millions of legal documents. When attorneys search for legal case precedents, the initial retrieval returns many documents. The company wants the chat assistant to generate all responses within 3 seconds. The foundation model (FM) that the chat assistant uses has a context window limitation that allows effective processing for only 10 documents for each query. Currently, the retrieval configuration fetches 50 documents by using semantic search. Attorneys report that highly relevant precedents frequently appear in positions 15-40 of the results. The company needs a solution to improve the relevance of query results. The solution must meet the company's latency and context window constraints. Which solution will meet these requirements?

  1. Maintain the 50-document retrieval but increase the FM's temperature parameter. Implement prompt engineering techniques that instruct the model to identify the most relevant documents from the full result set before the model generates responses.
  2. Enable reranking on the knowledge base by using a reranker model with language-specific configurations. Configure the chat assistant to initially retrieve 50 documents. Use the reranker model's cross-encoder architecture to evaluate query-document pairs. Return only the top 10 highest-scored documents. Correct Answer
  3. Configure three separate knowledge bases. Configure one knowledge base to use 500 token chunks, another to use 1,000 token chunks, and the third to use 2,000 token chunks. Implement a pre-processing action group by using an AWS Lambda function that retrieves 50 documents from each knowledge base, merges the 150 total results, and uses term frequency - inverse document frequency (TF-IDF) scoring to select the top 10 documents.
  4. Implement a post-processing action group by using an AWS Lambda function that retrieves 50 documents and calculates cosine similarity scores between the query embedding and each document embedding by using Amazon Titan Embeddings. Configure the action group to sort by similarity score and return the top 10 documents.

Community Insight

The question tests how to improve relevance when relevant results fall outside the FM's context window; the trap is assuming semantic search alone ranks well, or resorting to custom Lambda/TF-IDF/cosine re-scoring instead of the native reranking feature.

For Amazon Bedrock Knowledge Bases, enabling a reranker model reorders a wide initial retrieval (e.g., 50 documents) and returns only the top-scored results (e.g., 10) that fit the FM's context window. This question establishes that cross-encoder reranking is the mechanism that surfaces relevant precedents buried at positions 15–40 while preserving the 3-second latency budget.

Choosing option C or D — building custom Lambda-based merging with TF-IDF or recomputing cosine similarity. Both duplicate what the retrieval pipeline already does (embedding similarity), add Lambda cold-start and processing latency that threatens the 3-second target, and offer weaker relevance than a cross-encoder that scores the query and document jointly.

Community Discussion (1 comments)

TNT87 👍 1 Selected: B
Enable reranking on the knowledge base by using a reranker model with language-specific configurations. Configure the chat assistant to initially retrieve 50 documents. Use the reranker model's cross-encoder architecture to evaluate query-document pairs. Return only the top 10 highest-scored documents.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Amazon Bedrock Knowledge Bases support an optional reranking step (for example, using Amazon Rerank or Cohere Rerank models, with language-specific configuration) that runs after the initial vector/semantic retrieval. The reranker is a cross-encoder: it evaluates the query and each candidate document jointly, producing far more accurate relevance scores than the bi-encoder embeddings used in retrieval. This directly solves the reported symptom — relevant precedents at positions 15–40 — because reranking reorders the entire 50-document candidate set. By configuring the knowledge base to return only the top 10 results, the response fits the FM's 10-document context window and reduces prompt processing, which helps meet the 3-second response requirement. This is a native, managed capability requiring no custom code.

Why the Other Options Are Wrong

Option A fails because raising temperature only increases output randomness and has no effect on retrieval relevance; asking the model to scan all 50 documents also violates the 10-document context limit and burns latency. Option C builds three chunk-size knowledge bases and a Lambda that merges 150 results and applies TF-IDF — a lexical scoring method ill-suited to semantic legal-precedent matching, and the extra retrieval and processing would exceed the 3-second latency target. Option D recomputes cosine similarity between the query embedding and each document embedding, which is exactly the same scoring the vector search already performed, so it adds Lambda overhead without improving ranking of documents at positions 15–40; a cross-encoder reranker is strictly better here.

Community Comment Notes

A single community comment selected option B, reasoning that "Enable reranking on the knowledge base by using a reranker model with language-specific configurations" lets the assistant retrieve 50 documents and return only the top 10. That aligns with AWS's documented reranking feature for Bedrock Knowledge Bases and with the question's latency and context-window constraints, so the community pick is consistent with the vendor capability rather than being a guess.

Official Reference

Exam Strategy

When relevance suffers despite correct embeddings and relevant items rank low, look for the managed reranking option in Bedrock Knowledge Bases — it reorders a broad candidate set and returns only the top N to fit the context window; avoid custom Lambda post-processing unless reranking is unavailable.

Frequently Asked Questions

Why does reranking fix precedents that appear at positions 15–40 in the results?

A cross-encoder reranker rescores every candidate by jointly evaluating the query and each document, so relevant items buried by vector similarity move into the top 10 returned to the FM.

Why is recomputing cosine similarity in a Lambda function (option D) not effective?

Cosine similarity over the same embeddings is what vector retrieval already uses, so re-sorting by it changes nothing while adding Lambda latency that risks the 3-second response target.

More AIP-C01 FAQ →

Related Analysis

Practice All AIP-C01 Questions

Access 110 questions with complete answers and detailed explanations.

View Full AIP-C01 Practice Test →

← Back to AIP-C01 Study Guide