milvus icon indicating copy to clipboard operation
milvus copied to clipboard

[Bug]: REST V1 and V2: empty response when one of the candidate has nan distance

Open dumbPy opened this issue 9 months ago • 7 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

- Milvus version: v2.4.1
- Deployment mode(standalone or cluster): standalone
- SDK version(e.g. pymilvus v2.0.0rc2): 2.4.1
- OS(Ubuntu or CentOS): macOS

Current Behavior

When one of the candidate has nan distance, the rest api returns empty string as response.
Issue exists in both v1 and v2 rest apis.
This doesn't seem to be the issue with pymilvus

In below image, the pymilvus client returns valid objects while the rest api works fine till "limit":4 and returns empty string for any further limit as the distance reduces to nan.

Not sure how to reproduce this since the embeddings I am using here are not something I can share. I am using InnerProduct metric if that matters, and the vectors are of 300 dimension.

image

Expected Behavior

No response

Steps To Reproduce

No response

Milvus Log

No response

Anything else?

No response

dumbPy avatar May 09 '24 19:05 dumbPy

/assign @PowderLi please help on that

xiaofan-luan avatar May 10 '24 00:05 xiaofan-luan

/assign @PowderLi /unassign

yanliang567 avatar May 10 '24 01:05 yanliang567

/assign @zhuwenxing please keep an eye on this, thx

yanliang567 avatar May 10 '24 01:05 yanliang567

The weird thing about this issue is why the distance appears as "nan".

zhuwenxing avatar May 10 '24 02:05 zhuwenxing

The entities in question have zero vectors and that seem to trigger the nan. It should be 0 instead of nan.

dumbPy avatar May 10 '24 04:05 dumbPy

I tried to insert many all zero vectors and search on them, the distance is displayed well as 0, and the response also was not empty.

[2024-05-11 11:12:51 - DEBUG - urllib3.connectionpool]: http://10.104.1.35:19530 "POST /v2/vectordb/collections/create HTTP/1.1" 200 22 (connectionpool.py:473)
[2024-05-11 11:12:51 - DEBUG - ci_test]: 
method: post, 
url: http://10.104.1.35:19530/v2/vectordb/collections/create, 
cost time: 0.14714789390563965, 
header: {'Content-Type': 'application/json', 'Authorization': 'Bearer root:Milvus', 'RequestId': '5a07f456-0f44-11ef-9c92-acde48001122'}, 
payload: {"collectionName": "test_collection_2024_05_11_11_12_50_440059vwiViLkk", "schema": {"autoId": true, "enableDynamicField": true, "fields": [{"fieldName": "book_id", "dataType": "Int64", "isPrimary": tr...Type": "FloatVector", "elementTypeParams": {"dim": "128"}}]}, "indexParams": [{"fieldName": "float_vector", "indexName": "float_vector", "metricType": "IP"}], "params": {"consistencyLevel": "Strong"}}, 
response: {"code":200,"data":{}} (milvus.py:17)
[2024-05-11 11:12:51 - DEBUG - urllib3.connectionpool]: Starting new HTTP connection (1): 10.104.1.35:19530 (connectionpool.py:245)
[2024-05-11 11:12:51 - DEBUG - urllib3.connectionpool]: http://10.104.1.35:19530 "POST /v2/vectordb/collections/describe HTTP/1.1" 200 1087 (connectionpool.py:473)
[2024-05-11 11:12:51 - DEBUG - ci_test]: 
method: post, 
url: http://10.104.1.35:19530/v2/vectordb/collections/describe, 
cost time: 0.1290888786315918, 
header: {'Content-Type': 'application/json', 'Authorization': 'Bearer root:Milvus', 'RequestId': '5a1eb696-0f44-11ef-9c92-acde48001122'}, 
payload: {"collectionName": "test_collection_2024_05_11_11_12_50_440059vwiViLkk"}, 
response: {"code":200,"data":{"aliases":[],"autoId":true,"collectionID":449617770820131178,"collectionName":"test_collection_2024_05_11_11_12_50_440059vwiViLkk","consistencyLevel":"Strong","description":"","ena...e,"type":"FloatVector"}],"indexes":[{"fieldName":"float_vector","indexName":"float_vector","metricType":"IP"}],"load":"LoadStateLoading","partitionsNum":64,"properties":[],"shardsNum":1},"message":""} (milvus.py:17)
[2024-05-11 11:12:51 - INFO - ci_test]: rsp: {'code': 200, 'data': {'aliases': [], 'autoId': True, 'collectionID': 449617770820131178, 'collectionName': 'test_collection_2024_05_11_11_12_50_440059vwiViLkk', 'consistencyLevel': 'Strong', 'description': '', 'enableDynamicField': True, 'fields': [{'autoId': True, 'description': '', 'id': 100, 'name': 'book_id', 'partitionKey': False, 'primaryKey': True, 'type': 'Int64'}, {'autoId': False, 'description': '', 'id': 101, 'name': 'user_id', 'partitionKey': True, 'primaryKey': False, 'type': 'Int64'}, {'autoId': False, 'description': '', 'id': 102, 'name': 'word_count', 'partitionKey': False, 'primaryKey': False, 'type': 'Int64'}, {'autoId': False, 'description': '', 'id': 103, 'name': 'book_describe', 'params': [{'key': 'max_length', 'value': '256'}], 'partitionKey': False, 'primaryKey': False, 'type': 'VarChar'}, {'autoId': False, 'description': '', 'id': 104, 'name': 'float_vector', 'params': [{'key': 'dim', 'value': '128'}], 'partitionKey': False, 'primaryKey': False, 'type': 'FloatVector'}], 'indexes': [{'fieldName': 'float_vector', 'indexName': 'float_vector', 'metricType': 'IP'}], 'load': 'LoadStateLoading', 'partitionsNum': 64, 'properties': [], 'shardsNum': 1}, 'message': ''} (test_vector_operations.py:675)
[2024-05-11 11:12:51 - DEBUG - urllib3.connectionpool]: Starting new HTTP connection (1): 10.104.1.35:19530 (connectionpool.py:245)
[2024-05-11 11:12:52 - DEBUG - urllib3.connectionpool]: http://10.104.1.35:19530 "POST /v2/vectordb/entities/insert HTTP/1.1" 200 None (connectionpool.py:473)
[2024-05-11 11:12:52 - DEBUG - ci_test]: 
method: post, 
url: http://10.104.1.35:19530/v2/vectordb/entities/insert, 
cost time: 0.6702909469604492, 
header: {'Content-Type': 'application/json', 'Authorization': 'Bearer root:Milvus', 'Accept-Type-Allow-Int64': 'true', 'RequestId': '5a37237a-0f44-11ef-9c92-acde48001122'}, 
payload: {"collectionName": "test_collection_2024_05_11_11_12_50_440059vwiViLkk", "data": [{"user_id": 0, "word_count": 0, "book_describe": "book_0", "float_vector": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "dynamic_field_2999": 2999}]}, 
response: {"code":200,"data":{"insertCount":3000,"insertIds":[449617770818713663,449617770818713664,449617770818713665,449617770818713666,449617770818713667,449617770818713668,449617770818713669,449617770818713...8716652,449617770818716653,449617770818716654,449617770818716655,449617770818716656,449617770818716657,449617770818716658,449617770818716659,449617770818716660,449617770818716661,449617770818716662]}} (milvus.py:17)
[2024-05-11 11:12:53 - DEBUG - urllib3.connectionpool]: Starting new HTTP connection (1): 10.104.1.35:19530 (connectionpool.py:245)
[2024-05-11 11:12:56 - DEBUG - urllib3.connectionpool]: http://10.104.1.35:19530 "POST /v2/vectordb/entities/search HTTP/1.1" 200 None (connectionpool.py:473)
[2024-05-11 11:12:56 - DEBUG - ci_test]: 
method: post, 
url: http://10.104.1.35:19530/v2/vectordb/entities/search, 
cost time: 3.0752687454223633, 
header: {'Content-Type': 'application/json', 'Authorization': 'Bearer root:Milvus', 'Accept-Type-Allow-Int64': 'true', 'RequestId': '5b40110a-0f44-11ef-9c92-acde48001122'}, 
payload: {"collectionName": "test_collection_2024_05_11_11_12_50_440059vwiViLkk", "data": [[0.07760931870102615, 0.11648295978031525, 0.06759402962605651, 0.07627516229539759, 0.09439156081631465, 0.0089967893...473742655506]], "filter": "word_count > 100", "groupingField": "user_id", "outputFields": ["*"], "searchParams": {"metricType": "IP", "params": {"radius": "0.1", "range_filter": "0.8"}}, "limit": 100}, 
response: {"code":200,"data":[{"book_describe":"book_2460","book_id":449617770818716123,"distance":0,"dynamic_field_2460":2460,"float_vector":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":449617770818716662,"user_id":99,"word_count":2999}]} (milvus.py:17)
PASSED

zhuwenxing avatar May 11 '24 03:05 zhuwenxing

The entities in question have zero vectors and that seem to trigger the nan. It should be 0 instead of nan.

how to represent nan in restful?

xiaofan-luan avatar May 11 '24 07:05 xiaofan-luan

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

stale[bot] avatar Jun 11 '24 03:06 stale[bot]