Weighting scores in Hybrid Search.
In hybrid search, weighting controls how much the vector score and the keyword score contribute to the final rank. A common approach is a linear combination: score = α · score_vector + (1 − α) · score_keyword. Choosing α (e.g. 0.7 for vector-heavy, 0.3 for keyword-heavy) depends on the use case and whether the two score distributions are comparable. Normalization is often required before combining.
Summary
- In hybrid search, weighting controls how much vector vs. keyword score contributes; common form:
score = α · score_vector + (1 − α) · score_keyword(e.g. α = 0.7 for vector-heavy). - Vector and keyword scores live on different scales; to combine linearly you often normalize (min-max, z-score) or use rank-based RRF. Weighted fusion gives more control when scores are calibrated.
- Weights can be fixed or tuned on labeled data; some systems expose a single vector/keyword weight or per-query weights. For RAG and semantic-heavy workloads vector weight is often higher.
- Trade-off: weighted fusion lets you emphasize one signal but requires comparable or normalized scores; RRF avoids calibration but ignores magnitude. Pipeline: normalize scores, apply weights, sum, sort.
- Practical tip: normalize both streams to [0, 1] or z-score before combining; tune alpha on a small labeled set.
Score scales and normalization
Vector scores (e.g. cosine, inner product) and keyword scores (e.g. BM25) live on different scales and distributions. To combine them linearly you often need to normalize one or both—e.g. min-max to [0, 1], or z-score—so that one source doesn’t dominate. Alternatively, use rank-based fusion like RRF, which avoids scale issues by using only ranks. Pipeline: run both searches, normalize scores (min-max or z-score), compute weighted sum, sort by combined score. Weighted score fusion gives more control when you have calibrated or normalized scores and want to emphasize one signal (e.g. “prioritize exact match” by increasing keyword weight).
Tuning weights
Weights can be fixed per application or tuned on labeled data (e.g. relevance judgments). Some systems expose a single “vector weight” or “keyword weight” parameter; others let you attach weights per query or per field. For RAG and semantic-heavy workloads, vector weight is often higher; for product or document search with strong term importance, keyword weight may be increased. Trade-off: weighted fusion lets you emphasize one signal but requires comparable or normalized scores. Practical tip: normalize both streams to [0, 1] or z-score before combining; tune α on a small labeled set.
Frequently Asked Questions
How do I weight vector vs. keyword in hybrid search?
Common approach: score = α · score_vector + (1 − α) · score_keyword. Choose α (e.g. 0.7 vector-heavy, 0.3 keyword-heavy) based on use case; ensure score distributions are comparable (normalize if needed). See hybrid search.
Why normalize before combining?
Vector (e.g. cosine, inner product) and keyword (e.g. BM25) scores live on different scales. Min-max or z-score normalization prevents one source from dominating. Alternatively use RRF, which avoids scale issues by using only ranks.
Should I fix weights or tune them?
You can fix α per application or tune on labeled data (relevance judgments). Some VDBs expose a single vector/keyword weight; others support per-query or per-field weights. For RAG, vector weight is often higher.
When is weighted fusion better than RRF?
When you have calibrated or normalized scores and want to emphasize one signal (e.g. prioritize exact match by increasing keyword weight). RRF is simpler and does not require comparable scales.