Skip to content

Uploaded and retrived vectors are different #727

Answered by hash-f
paniabhisek asked this question in Q&A
Discussion options

You must be logged in to vote

This is the expected behavior.

Qdrant normalizes the vectors when they are stored to ensure that the distance calculations (like cosine similarity) are meaningful and consistent. When vectors are normalized, their magnitudes are scaled to 1, which simplifies the comparison process by focusing solely on the direction of the vectors rather than their magnitude.

A quick example of how normalization works

import numpy as np

def normalize_vector(vector):
    norm = np.linalg.norm(vector)
    if norm == 0:
        return vector
    return vector / norm

vector = np.array([0.05, 0.61, 0.76, 0.74])
normalized_vector = normalize_vector(vector)
print(normalized_vector)

# Output
# [0.04082755 0.49…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by paniabhisek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants