SnowPro Specialty: Gen AI exam dumps

SnowPro Specialty: Gen AI practice question 123 of 287

SnowPro® Specialty: Gen AI. Expert level, Snowflake. Free question with the correct answer and a full explanation.

SnowPro Specialty: Gen AI Question 123

Single answerVECTOR_L1_DISTANCE

A retail analytics team stores product-description embeddings in a Snowflake table as VECTOR(FLOAT, 768). They want to find products whose embeddings are most similar to a new query embedding generated by the same model. An engineer proposes using VECTOR_L1_DISTANCE in the ORDER BY clause. Which approach correctly applies VECTOR_L1_DISTANCE for this nearest-neighbor search scenario?

  1. A

    Order rows by VECTOR_L1_DISTANCE(product_embedding, query_embedding) ascending, ensuring both vectors have the same dimensions and comparable numeric element types.

  2. B

    Order rows by VECTOR_L1_DISTANCE(product_embedding, query_embedding) descending, because larger L1 distance indicates greater similarity between embeddings.

  3. C

    Use VECTOR_L1_DISTANCE only after converting both vectors to VARCHAR, because Snowflake vector distance functions require string inputs.

  4. D

    Use VECTOR_L1_DISTANCE even if product_embedding is VECTOR(FLOAT, 768) and query_embedding is VECTOR(FLOAT, 1536), because Snowflake automatically truncates the longer vector.

Show answer and explanation

Correct answer: A

Explanation

VECTOR_L1_DISTANCE computes Manhattan distance between two VECTOR values. In retrieval scenarios, it can be used to rank candidates by proximity to a query embedding, with lower distance meaning greater similarity. Therefore, the correct usage is to sort ascending by VECTOR_L1_DISTANCE(embedding_column, query_vector). A key best practice is to compare embeddings produced by the same model so the vectors have the same dimensionality and represent the same semantic space. Snowflake's vector functions are designed to work on VECTOR data types directly; they do not require casting to strings. Also, mismatched vector dimensions are not automatically corrected. This aligns with Snowflake documentation for VECTOR data type usage and vector similarity/distance functions, where compatible vector dimensions and direct VECTOR operations are required.

  • A. Correct.

    Correct. VECTOR_L1_DISTANCE returns the Manhattan distance between two vectors. For nearest-neighbor style retrieval using a distance metric, smaller values indicate greater similarity, so results should be sorted in ascending order. In practice, both vectors must be compatible for comparison, including matching dimensionality. This is the valid pattern when comparing stored embeddings to a query embedding generated by the same model.

  • B. Incorrect.

    Incorrect. This reverses the meaning of a distance metric. With L1 distance, larger values mean vectors are farther apart, not closer. Sorting descending would surface the least similar products rather than the nearest matches.

  • C. Incorrect.

    Incorrect. Snowflake vector distance functions operate on VECTOR values, not VARCHAR representations. Converting vectors to strings would prevent proper numerical distance computation and reflects a misunderstanding of how Snowflake VECTOR functions are used.

  • D. Incorrect.

    Incorrect. Snowflake does not automatically truncate or reconcile mismatched vector dimensions for VECTOR_L1_DISTANCE. Vectors must be dimensionally compatible. If embeddings come from different models with different output sizes, they should not be directly compared using this function.

Timed practice exam

Take a SnowPro Specialty: Gen AI practice test under exam conditions

55 questions in 85 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam