我的数据库中有100万条记录,其模式如下:
schema embeddings {
document embeddings {
field id type int {}
field text_embedding type tensor<double>(d0[960]) {
indexing: attribute | index
attribute {
distance-metric: euclidean
}
index {
hnsw {
max-links-per-node: 16
neighbors-to-explore-at-insert: 100
}
}
}
}
rank-profile closeness {
num-threads-per-search:1
inputs {
query(query_embedding) tensor<double>(d0[960])
}
first-phase {
expression: closeness(field, text_embedding)
}
}
}我查找最近邻居的查询如下所示:
body = {
'yql': 'select * from embeddings where ({approximate:true, targetHits:100} nearestNeighbor(text_embedding, query_embedding));',
"hits":100,
'input': {
'query(query_embedding)': [...],
},
"ranking": {
"profile": "closeness",
"softtimeout": {
"enable": false
}
}
}由于某些原因,由于某些向量,结果的数量比targetHits小。更改超时无助于此。
以下是响应中的覆盖率部分:
"id": "toplevel",
"relevance": 1.0,
"fields": {
"totalCount": 39
},
"coverage": {
"coverage": 100,
"documents": 1000000,
"full": true,
"nodes": 1,
"results": 1,
"resultsFull": 1
},是否有任何方法可以准确地(或至少不少于)接收targetHits结果(显然有足够的结果,因为可以为db中的任何其他向量计算封闭度)?
发布于 2022-10-14 06:02:51
当您请求targetHits:100时,Vespa将向每个内容节点的first-phase排名阶段公开。如果没有,那么我们会非常感兴趣的是如何繁殖。这最好通过在github vespa-发动机/vespa上创建一个问题来完成。还支持在first-phase排名中使用rank-score-drop-limit减少点击率,这可以减少结果集和totalCount。这里似乎没有启用此功能。
hits参数(或YQL中的limit )控制响应中返回的命中次数。
Vespa的默认超时时间是500 is,如果您的系统负载过重(或者使用approximate:false进行精确搜索),您可能会看到软超时,其中Vespa返回部分结果。这种情况反映在返回的结果coverage元素中。
https://stackoverflow.com/questions/74061614
复制相似问题