Retrieval Weights
Fine-tune the balance between retrieval methods for optimal results.
Default Weights
python
{
"dense": 0.5, # Semantic similarity
"sparse": 0.3, # Term expansion
"bm25": 0.2 # Exact matching
}Setting Weights
python
results = client.search(
query="technical specification",
options={
"weights": {
"dense": 0.4,
"sparse": 0.3,
"bm25": 0.3
}
}
)Recommended Configurations
General Purpose
json
{ "dense": 0.5, "sparse": 0.3, "bm25": 0.2 }Technical Documentation
json
{ "dense": 0.3, "sparse": 0.3, "bm25": 0.4 }Conversational Queries
json
{ "dense": 0.6, "sparse": 0.3, "bm25": 0.1 }Exact Match Priority
json
{ "dense": 0.2, "sparse": 0.2, "bm25": 0.6 }Organization-Level Defaults
Set default weights for your organization:
python
client.settings.update({
"default_weights": {
"dense": 0.5,
"sparse": 0.3,
"bm25": 0.2
}
})A/B Testing Weights
Compare different configurations:
python
from lakehouse42 import ABTest
test = ABTest(
name="weight_optimization",
variants=[
{"dense": 0.5, "sparse": 0.3, "bm25": 0.2},
{"dense": 0.4, "sparse": 0.4, "bm25": 0.2},
]
)
results = client.search(query="...", ab_test=test)