Clarify refine_factor, set default to 30

This commit is contained in:
Yiorgis Gozadinos 2025-11-21 15:53:24 +02:00
parent 2f54ee7d59
commit 6d8ab2575d
No known key found for this signature in database
3 changed files with 7 additions and 6 deletions

View file

@ -7,7 +7,7 @@
- Creates IVF_PQ indexes
- Requires minimum 256 chunks (LanceDB training data requirement)
- New `search.vector_index_metric` config option: `cosine` (default), `l2`, or `dot`
- New `search.vector_refine_factor` config option (default: 10) for accuracy/speed tradeoff
- New `search.vector_refine_factor` config option (default: 30) for accuracy/speed tradeoff
- Indexes not created automatically during ingestion to avoid performance degradation
- Manual rebuilding required after adding significant new data
- **Enhanced Info Command**: `haiku-rag info` now shows storage sizes and vector index statistics
@ -17,7 +17,7 @@
### Changed
- **Evaluations**: Improved evaluation dataset naming and simplified evaluator
- **Evaluations**: Improved evaluation dataset naming and simplified evaluator
- configuration
- `EvalDataset` now accepts dataset name for better organization in Logfire
- Added `--name` CLI parameter to override evaluation run names

View file

@ -88,7 +88,7 @@ research:
search:
vector_index_metric: cosine # cosine, l2, or dot
vector_refine_factor: 10
vector_refine_factor: 30
agui:
host: "0.0.0.0"
@ -732,14 +732,15 @@ Configure vector indexing behavior for efficient similarity search:
```yaml
search:
vector_index_metric: cosine # cosine, l2, or dot
vector_refine_factor: 10 # Re-ranking factor for accuracy
vector_refine_factor: 30 # Re-ranking factor for accuracy
```
- **vector_index_metric**: Distance metric for vector similarity:
- `cosine`: Cosine similarity (default, best for most embeddings)
- `l2`: Euclidean distance
- `dot`: Dot product similarity
- **vector_refine_factor**: Retrieve `refine_factor * limit` candidates and re-rank in memory for better accuracy. Higher values increase accuracy but slow down queries. Default: 10
- **vector_refine_factor**: Improves accuracy when using a vector index by retrieving `refine_factor * limit` candidates (using approximate search) and re-ranking them with exact distances. Higher values increase accuracy but slow down queries. Default: 30
- **Only applies with a vector index** - has no effect on brute-force search, which already returns exact results
!!! note
Vector indexes are only necessary for large datasets with over 100,000 chunks. For smaller datasets, LanceDB's brute-force kNN search provides exact results with good performance. Only create an index if you notice search performance degradation on large datasets.

View file

@ -83,7 +83,7 @@ class ProcessingConfig(BaseModel):
class SearchConfig(BaseModel):
vector_index_metric: Literal["cosine", "l2", "dot"] = "cosine"
vector_refine_factor: int = 10
vector_refine_factor: int = 30
class OllamaConfig(BaseModel):