Vector Similarity Functions

The measurement of similarity between vectors is a fundamental operation in semantic comparison. For example, you need this operation to find the top N number of closest vectors to a query vector, which can be used for a semantic search. Vector search also enables developers to improve the accuracy of their generative AI responses by providing related documents to a large language model.

Snowflake Cortex provides three vector similarity functions:




Each function takes two VECTOR arguments of equal element type and dimension and computes the specified metric over them.


Due to computational optimizations in these functions, floating-point errors may be slightly larger than usual (e.g. about 1e-4).

List of Functions

Function Name


Not supported in Snowpark API.