You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-22Lines changed: 21 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,15 @@
9
9
10
10
# Retrieval Optimizer
11
11
12
-
Search and information retrieval is a challenging and often misunderstood problem. With the proliferation of vector search tools on the market, attention has increasingly shifted toward SEO gains and marketing claims—sometimes at the expense of actual retrieval quality.
12
+
The **Redis Retrieval Optimizer** is a framework for systematically measuring and improving retrieval performance for vector and hybrid search. The framework helps you select the best combination of embedding model, index type, and query settings for your specific use case.
13
13
14
-
The **Retrieval Optimizer** from Redis is designed to bring focus back to what matters: delivering relevant, high-quality results. This flexible framework enables you to systematically measure and improve retrieval performance for your specific data and use case. Rather than relying on guesswork or vague intuition, the Retrieval Optimizer helps you establish **baseline metrics** that serve as a foundation for meaningful evaluation and iteration.
14
+
To use the Retrieval Optimizer, you start with a labeled data set consisting of a corpus of texts, a set of natural language questions, and a collection of labels. You also define a set of search methods and embedding models to test against.
15
15
16
-
Beyond accuracy alone, it also supports evaluating critical tradeoffs between **cost, speed, and latency**, helping you understand how different embedding models, retrieval strategies, and index configurations impact overall system performance. The ultimate goal is to enable **metrics-driven development** for your search application—ensuring that decisions are grounded in data, not assumptions.
16
+
The Retrieval Optimizer then lets you evaluate critical tradeoffs between **cost, speed, and latency**, helping you understand how different embedding models, retrieval strategies, and index configurations impact overall system performance. The tool's **Bayesian optimization** mode lets your fine-tune these index configurations. Ultimately, the tools let you implement **metrics-driven development** for your search applications — ensuring that decisions are grounded in data, not assumptions.
17
17
18
18
# Example notebooks
19
19
20
-
For complete code examples see the following notebooks:
20
+
For complete code examples, see the following notebooks:
21
21
22
22
| Topic | Notebook |
23
23
| ------ | ------- |
@@ -26,18 +26,17 @@ For complete code examples see the following notebooks:
| Embedding model comparison |[00_comparison.ipynb](https://github.com/redis-applied-ai/redis-retrieval-optimizer/blob/main/docs/examples/comparison/00_comparison.ipynb)|
28
28
29
-
# Quick Start
29
+
# Quick start
30
30
31
31
The Retrieval Optimizer supports two *study* types: **Grid** and **Bayesian Optimization**. Each is suited to a different stage of building a high-quality search system.
32
32
33
33
### Grid
34
34
35
35
Use a grid study to explore the impact of different **embedding models** and **retrieval strategies**. These are typically the most important factors influencing search performance. This mode is ideal for establishing a performance baseline and identifying which techniques work best for your dataset.
36
36
37
-
### Bayesian Optimization
38
-
39
-
Once you've identified a solid starting point, use Bayesian optimization to **fine-tune your index configuration**. It intelligently selects the most promising combinations to try—saving time compared to exhaustive testing. This mode is especially useful for balancing **cost, speed, and latency** as you work toward a production-ready solution.
37
+
### Bayesian optimization
40
38
39
+
Once you've identified a solid starting point, use Bayesian optimization to **fine-tune your index configuration**. This mode intelligently selects the most promising combinations to test, in place of exhaustive testing (which is time-consuming). Bayesian optimization mode is especially useful for balancing **cost, speed, and latency** as you work toward a production-ready solution.
Selects the next best configuration to try based on a heuristic. This is good when it would take a very long time to test all possible configurations.
104
103
105
104
#### Study config:
@@ -193,7 +192,7 @@ metrics = run_bayes_study(
193
192
194
193
195
194
196
-
# Search Methods
195
+
# Search methods
197
196
198
197
Below is a comprehensive table documenting the built-in search methods available in the Redis Retrieval Optimizer:
199
198
@@ -205,14 +204,14 @@ Below is a comprehensive table documenting the built-in search methods available
205
204
| rerank | Two-stage retrieval with cross-encoder reranking | When high precision is crucial and latency is less important | <ul><li>First-stage retrieval with BM25/vector</li><li>Second-stage reranking with cross-encoder</li><li>Uses HuggingFace cross-encoder model</li><li>Higher quality but increased latency</li></ul> |
206
205
| weighted_rrf | Reciprocal Rank Fusion with weights | Combining multiple search strategies with controlled blending | <ul><li>Fuses BM25 and vector search results</li><li>Configurable weighting between methods</li><li>Handles cases where methods have complementary strengths</li><li>Parameter k controls how quickly rankings decay</li></ul> |
207
206
208
-
### Implementation Details
207
+
### Implementation details
209
208
210
209
- All search methods follow a common interface taking a SearchMethodInput and returning a SearchMethodOutput
211
210
- Query times are automatically tracked in the query_metrics object
212
211
- Each method handles error cases gracefully, returning empty results rather than failing
213
212
- Results are returned as a `ranx.Run` object for consistent evaluation
214
213
215
-
### Extending with Custom Methods
214
+
### Extending with custom methods
216
215
217
216
You can create custom search methods by implementing a function that:
The Retrieval Optimizer is designed to be flexible and extensible. You can define your own **corpus processors** and **search methods** to support different data formats and retrieval techniques. This is especially useful when working with domain-specific data or testing out experimental search strategies.
235
234
236
-
### Why Custom Functions Matter
235
+
### Why custom functions matter
237
236
238
237
Every search application is unique. You might store metadata differently, rely on custom vector filtering, or want to experiment with hybrid techniques. The framework makes it easy to plug in your own logic without needing to rewrite core infrastructure.
239
238
@@ -277,7 +276,7 @@ search_methods: ["basic_vector", "pre_filter_vector"] # must match what is passe
277
276
278
277
---
279
278
280
-
### Writing Custom Search Methods
279
+
### Writing custom search methods
281
280
282
281
Search methods can be anything you want as long as the function accepts a `SearchMethodInput` and returns a `SearchMethodOutput`. This allows you to test new retrieval strategies, add filters, or layer on post-processing logic.
To run a retrieval study, you need three key datasets: **queries**, **corpus**, and **qrels**. The framework is flexible—data can be in any shape as long as you provide custom processors to interpret it. But if you're getting started, here's the expected format and some working examples to guide you.
367
+
To run a retrieval study, you need three key datasets: **queries**, **corpus**, and **qrels**. The framework is flexible—data can be in any shape as long as you provide custom processors to interpret it. But if you're just getting started, here's the expected format and some working examples to guide you.
369
368
370
369
---
371
370
372
371
### Corpus
373
372
374
-
This is the full set of documents you'll be searching against. It’s what gets indexed into Redis. The default assumption is that each document has a `text` field to search or embed, but you can customize this via a corpus processor.
373
+
This is the full set of documents you'll be searching against. It’s what gets indexed into Redis. The default assumption is that each document has a `text` field to search or embed, but you can customize this using a corpus processor.
375
374
376
375
**General structure**:
377
376
@@ -401,7 +400,7 @@ This is the full set of documents you'll be searching against. It’s what gets
401
400
402
401
### Queries
403
402
404
-
These are the search inputs you'll evaluate against the corpus. Each query should have a unique ID and the query text.
403
+
These are the search inputs you'll evaluate against the corpus. Each query consist of the query text itself and a unique ID.
0 commit comments