SnowPro Specialty: Gen AI exam dumps

SnowPro Specialty: Gen AI practice question 128 of 287

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

SnowPro Specialty: Gen AI Question 128

Single answerVECTOR_COSINE_SIMILARITY

A retail company stores product-description embeddings in a Snowflake table to power semantic search. The embeddings were generated by the same model and stored in a VECTOR column. During testing, analysts use VECTOR_COSINE_SIMILARITY(query_embedding, product_embedding) to rank products for a user query. They notice that some rows return NULL similarity scores and are therefore excluded from the top results, even though the underlying product records exist. Which action is the best way to make the similarity ranking reliable without changing the ranking logic itself?

  1. A

    Ensure both the query embedding and product_embedding are non-NULL VECTOR values with the same dimensionality before calling VECTOR_COSINE_SIMILARITY.

  2. B

    Replace VECTOR_COSINE_SIMILARITY with VECTOR_INNER_PRODUCT because inner product ignores NULL values in vectors.

  3. C

    Cast the VECTOR columns to VARCHAR before comparison so Snowflake can compare vectors even when dimensions differ.

  4. D

    Normalize the product text to uppercase before generating embeddings so VECTOR_COSINE_SIMILARITY does not return NULL.

Show answer and explanation

Correct answer: A

Explanation

VECTOR_COSINE_SIMILARITY is used to compare two VECTOR values and is appropriate for semantic search when embeddings come from the same model space. In a production pipeline, the most common causes of unreliable results are missing embeddings (NULLs) or incompatible vectors, such as mismatched dimensions caused by different embedding models or configurations. The correct remediation is to validate inputs before scoring, for example by filtering out NULL embeddings, ensuring query embeddings are generated successfully, and maintaining a consistent embedding dimension across stored and query vectors. Replacing cosine similarity with another metric would alter retrieval behavior, and converting vectors to strings is not a valid semantic-search technique. This aligns with Snowflake best practices for vector functions: use proper VECTOR types, preserve embedding consistency, and handle NULLs explicitly in SQL pipelines.

  • A. Correct.

    Correct. VECTOR_COSINE_SIMILARITY requires valid VECTOR inputs. In practice, reliability depends on ensuring embeddings are present and compatible, including matching dimensionality from the same embedding model or configuration. If either argument is NULL, the function returns NULL, which can remove rows from ranked results unless handled explicitly. Validating or filtering for non-NULL embeddings before similarity scoring is the best fix when you want to keep cosine-similarity ranking unchanged.

  • B. Incorrect.

    Incorrect. VECTOR_INNER_PRODUCT is a different similarity operation and would change the ranking logic, which the scenario explicitly says should remain unchanged. It also does not solve NULL handling by 'ignoring' NULL values; NULL inputs generally propagate to NULL results in Snowflake SQL functions.

  • C. Incorrect.

    Incorrect. Casting vectors to VARCHAR does not create a meaningful semantic comparison and does not solve dimension compatibility for vector similarity. VECTOR_COSINE_SIMILARITY operates on VECTOR data, not string representations. This option reflects a misconception that type conversion can bypass vector requirements.

  • D. Incorrect.

    Incorrect. Text normalization can be a preprocessing choice for some pipelines, but it does not address the direct cause of NULL similarity results. NULL scores are driven by invalid or missing vector inputs, not by letter casing in the original source text.

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