diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e01df74..e50da252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/configuration.md b/docs/configuration.md index 98f3a698..8a1fdb23 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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. diff --git a/haiku_rag_slim/haiku/rag/config/models.py b/haiku_rag_slim/haiku/rag/config/models.py index fdd1a09f..59807bae 100644 --- a/haiku_rag_slim/haiku/rag/config/models.py +++ b/haiku_rag_slim/haiku/rag/config/models.py @@ -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):