概念
Reranking and retrieval strategies
Tune how many chunks come back, how they are searched and how they are reordered.
このレッスンはまだ翻訳されていないため、英語で表示しています。
- 1The question goes to the knowledge base.
- 2Search returns the top-k chunks. Filters apply here.
- 3A reranker reorders them and a few best go into the prompt.
流れ
- 1The question goes to the knowledge base.
- 2Search returns the top-k chunks. Filters apply here.
- 3A reranker reorders them and a few best go into the prompt.
Retrieve wide, rerank, then send a few chunks to the model.
Search type
- What it does
- Semantic or hybrid
- Trade-off
- Hybrid needs a supported store
Top-k
- What it does
- Most chunks returned
- Trade-off
- More recall, more tokens
Metadata filter
- What it does
- Limits search by attributes
- Trade-off
- Needs metadata files
Score cut-off
- What it does
- Your code drops low scores
- Trade-off
- Too high loses answers
Reranker
- What it does
- Reorders by relevance
- Trade-off
- Extra cost and delay
| Setting | What it does | Trade-off |
|---|---|---|
| Search type | Semantic or hybrid | Hybrid needs a supported store |
| Top-k | Most chunks returned | More recall, more tokens |
| Metadata filter | Limits search by attributes | Needs metadata files |
| Score cut-off | Your code drops low scores | Too high loses answers |
| Reranker | Reorders by relevance | Extra cost and delay |
1 / 2
Search type
- What it does
- Semantic or hybrid
- Trade-off
- Hybrid needs a supported store
Top-k
- What it does
- Most chunks returned
- Trade-off
- More recall, more tokens
Metadata filter
- What it does
- Limits search by attributes
- Trade-off
- Needs metadata files
| Setting | What it does | Trade-off |
|---|---|---|
| Search type | Semantic or hybrid | Hybrid needs a supported store |
| Top-k | Most chunks returned | More recall, more tokens |
| Metadata filter | Limits search by attributes | Needs metadata files |
2 / 2
Score cut-off
- What it does
- Your code drops low scores
- Trade-off
- Too high loses answers
Reranker
- What it does
- Reorders by relevance
- Trade-off
- Extra cost and delay
| Setting | What it does | Trade-off |
|---|---|---|
| Score cut-off | Your code drops low scores | Too high loses answers |
| Reranker | Reorders by relevance | Extra cost and delay |
概要
Retrieval has a few settings. Search type: semantic search matches meaning through embeddings. Hybrid search adds a keyword match on the raw text, which helps with product codes and names. Hybrid works only on some vector stores (Amazon RDS, OpenSearch Serverless and MongoDB) that have a filterable text field. Otherwise Bedrock uses semantic search. The number of results (top-k) sets the most chunks returned. The default is 5. With hierarchical chunking the count is of child chunks, so you may get fewer.
概要
A metadata filter limits search to chunks whose attributes match, such as year or product, with operators like equals, in and greaterThan, combined with andAll and orAll. It needs metadata files in the data source. Each result also carries a score, so your code can drop weak chunks before the prompt is built.
概要
A reranker model scores each retrieved chunk against the question and reorders them. It works on text only. Retrieve a wider set, rerank, and keep a few. The foundation model then reads fewer, better chunks, which can lower its cost and latency. The reranker itself adds a model call, so it adds cost and some delay. Use it through the Rerank API, or turn it on in Retrieve and RetrieveAndGenerate.
覚えること
- Semantic: meaning. Hybrid: meaning plus keywords, only on some vector stores.
- Top-k sets the most results returned. Default 5.
- Metadata filters need metadata files and narrow search before ranking.
- A reranker reorders retrieved chunks by relevance. Text only.
- Reranking adds cost and latency, but can shrink the prompt.
試験では
- “Exact product codes are missed by semantic search” points to hybrid search.
- “Only search documents from the current year” points to a metadata filter.
- “Top results are close but the best chunk is not first” points to a reranker model.
- “Fewer tokens sent to the model without losing the best chunks” points to retrieving more and reranking down.
このタスクの内容 · 3.1
- Compute environments and deployment targets
- SageMaker hosting
- Real-time and serverless inference
- Asynchronous and batch inference
- Multi-model and multi-container endpoints, inference components
- Choosing a deployment orchestrator
- Foundation model deployment options
- Hosting large models on SageMaker
- Bringing in models built outside AWS
Agents Classic
AgentCore
- Agent protocols and multi-agent patterns
- Reranking and retrieval strategies