1Z0-184-25 Question 21
Single answerYou manage an e-commerce platform on Oracle Cloud Infrastructure, where you store product descriptions as 768-dimensional embeddings generated by a pre-trained language model. The embeddings are already normalized to unit length. Your goal is to provide users with semantically similar product recommendations based on the smallest angular difference. Which distance function is most appropriate for retrieving the top-N results that align with these similarity requirements?
- A
Cosine distance
- B
Euclidean distance
- C
Manhattan distance
- D
Hamming distance
Show answer and explanation
Correct answer: A
Explanation
Because the embeddings are normalized to unit vectors, the primary factor is whether two vectors point in the same direction. Cosine distance (1 − Cosine Similarity) is specifically designed to capture angular differences, making it ideal for semantic similarity on normalized embeddings. For more information, see Oracle Cloud Infrastructure documentation on Vector Search and the Oracle Database Documentation (23c and later) regarding AI vector support and distance functions.
- A. Correct.
Correct. Cosine distance (or equivalently 1 - cosine similarity) is well-suited for normalized embeddings, particularly when you care about angular difference. Since your embeddings are already normalized, cosine distance emphasizes direction rather than magnitude and aligns well with semantic similarity.
- B. Incorrect.
Incorrect. Euclidean distance measures the magnitude of difference in vector space and doesn't focus on the angle between vectors. This can be less effective for normalized embeddings where direction (i.e., semantic content) matters most.
- C. Incorrect.
Incorrect. Manhattan distance (L1 norm) sums the absolute differences of each dimension, which is typically not used for measuring angle-based similarity in normalized embeddings. It can be more sensitive to scale differences rather than just direction.
- D. Incorrect.
Incorrect. Hamming distance is used for comparing discrete, binary vectors and is irrelevant for continuous numeric embeddings. It does not measure semantic similarity in floating-point embeddings.