AWS Security ChangesHomeSearch

AWS neptune-analytics documentation change

Service: neptune-analytics · 2025-06-19 · Documentation low

File: neptune-analytics/latest/userguide/vectors-distance.md

Summary

Added support for multiple distance metrics (L2Squared, L2, CosineSimilarity, etc.) in the vectors.distance algorithm, including syntax updates and detailed metric explanations.

Security assessment

The changes introduce new configuration options for distance metrics but do not address security vulnerabilities or directly document security features. The updates enhance functionality without explicit security implications.

Diff

diff --git a/neptune-analytics/latest/userguide/vectors-distance.md b/neptune-analytics/latest/userguide/vectors-distance.md
index f01e73f69..91ae3459d 100644
--- a//neptune-analytics/latest/userguide/vectors-distance.md
+++ b//neptune-analytics/latest/userguide/vectors-distance.md
@@ -5 +5 @@
-SyntaxInputsOutputsQuery exampleSample output
+SyntaxInputsOutputsQuery examplesSample output
@@ -9 +9 @@ SyntaxInputsOutputsQuery exampleSample output
-The `.vectors.distance` algorithm computes the distance between two nodes based on their embeddings. The distance is the squared L2 norm of their embedding vectors.
+The `.vectors.distance` algorithm computes the distance between two nodes based on their embeddings. The default distance is the squared L2 norm.
@@ -16 +16,5 @@ The `.vectors.distance` algorithm computes the distance between two nodes based
-    CALL neptune.algo.vectors.distance(n, m)
+    CALL neptune.algo.vectors.distance(n, m,
+       {
+           metric: The distance computation metric (optional)
+       }
+    )
@@ -29,0 +34,44 @@ The result of a `MATCH` statement from which you want to get the targets of the
+  * **metric** _(optional)_ – _type:_ `string` _default: L2Squared_. 
+
+The distance metric to use for distance computation. 
+
+    * Must be one of [L2Squared, L2, CosineSimilarity, CosineDistance, DotProduct]. 
+
+    * Case-insensitive. 
+
+    * The descriptions for the metrics, where x and y are vectors, x_i and y_i are the components of x and y vectors, θ is the angle between the x and y vectors, ||x|| denotes the magnitude (length, l2-norm, norm2) of vector x, ∑ denotes summation: 
+
+      * L2-Squared: Squared Euclidean distance between two vectors: 
+
+![L2-Squared: Squared Euclidean distance between two vectors.](/images/neptune-analytics/latest/userguide/images/vectors-distance/L2Squared.png)
+
+For more information on L2-Squared, see [ https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance](https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance). 
+
+      * L2: Euclidean distance (L2 norm) between two vectors: 
+
+![L2: Euclidean distance \(L2 norm\) between two vectors.](/images/neptune-analytics/latest/userguide/images/vectors-distance/L2.png)
+
+For more information on L2, see [ https://en.wikipedia.org/wiki/Euclidean_distance](https://en.wikipedia.org/wiki/Euclidean_distance). 
+
+      * Dot Product: Inner dot product of two vectors: 
+
+![Dot Product: Inner dot product of two vectors.](/images/neptune-analytics/latest/userguide/images/vectors-distance/dot1.png)
+
+For more information on Dot Product, see [ https://en.wikipedia.org/wiki/Dot_product](https://en.wikipedia.org/wiki/Dot_product). 
+
+      * Cosine Similarity: Measures the cosine of the angle between two vectors (higher value means more similar): 
+
+![Cosine Similarity: Measures the cosine of the angle between two vectors \(higher value means more similar\).](/images/neptune-analytics/latest/userguide/images/vectors-distance/cossimi4.png)
+
+Range: [-1, 1] 
+
+For more information on Cosine Similarity, see [ https://en.wikipedia.org/wiki/Cosine_similarity](https://en.wikipedia.org/wiki/Cosine_similarity). 
+
+      * Cosine Distance: Opposite of cosine similarity (lower value means more similar): 
+
+![Cosine Distance: Opposite of cosine similarity \(lower value means more similar\).](/images/neptune-analytics/latest/userguide/images/vectors-distance/cosdist1.png)
+
+Range: [0, 2] 
+
+For more information on Cosine Distance, see [ https://en.wikipedia.org/wiki/Cosine_similarity#Cosine_distance](https://en.wikipedia.org/wiki/Cosine_similarity#Cosine_distance). 
+
@@ -50 +98 @@ For every pair of source node and target node:
-## `.vectors.distance` query example
+## `.vectors.distance` query examples
@@ -58,0 +107,7 @@ For every pair of source node and target node:
+    
+    MATCH ( n {`~id`: "106"} )
+    MATCH ( m {`~id`: "110"} )
+    CALL neptune.algo.vectors.distance( n, m, {metric: "CosineSimilarity"} )
+    YIELD distance
+    RETURN n, m, distance
+