FlagOpen / FlagEmbedding

Retrieval and Retrieval-augmented LLMs
MIT License
7.11k stars 519 forks source link

在使用bge-large-zh v1.5配合milvus时,如何进行搜索配置 #534

Open xxbshow opened 7 months ago

xxbshow commented 7 months ago

在把向量保存到milvus后想使用milvus的搜索,这时搜索算法选择什么比较好,milvus提供点积和余弦相似,看示例代码bge用的是点积,但是测试下来点积的结果最高就是0.4附近,请问这样配置正确吗 index_params = { "metric_type": "IP", # 使用点积,欧氏距离L2 "index_type": "IVF_FLAT", # 使用IVF_FLAT索引 "params": {"nlist": 1024} # 索引构建参数,nlist值根据数据量和查询性能要求调整 }

staoxiao commented 7 months ago

bge使用的是余弦相似度。示例代码中,对向量进行了normlize,因此计算点积就等于余弦相似度。