Table of Contents
Fetching ...

Arkade: k-Nearest Neighbor Search With Non-Euclidean Distances using GPU Ray Tracing

Durga Mandarapu, Vani Nagarajan, Artem Pelenitsyn, Milind Kulkarni

TL;DR

Arkade introduces two general reductions, Filter-Refine (FR) and Monotone Transformation (MT), to enable kNN queries with non-Euclidean distances to be accelerated on GPU ray-tracing (RT) cores, which traditionally optimize Euclidean metrics. FR decouples the search into a radius-based filtering step and a refinement step, mapping the process to RT-core BVH traversal and shader-based distance calculations for general $D$, with correctness guarantees. MT handles distance functions whose geometry is not readily represented by RT objects by applying monotone transformations to preserve distance order, enabling an $L^2$-based RT search on transformed data (e.g., cosine distance via normalization). Empirical results on a RTX 4060 Ti show substantial speedups (up to hundreds of times faster) over state-of-the-art baselines for several distances and datasets, while analyses highlight factors like BVH quality, ray-AABB intersections, and dataset distribution as key performance drivers. The work broadens the applicability of RT-core acceleration to low-dimensional, non-Euclidean kNN tasks and offers practical strategies for choosing distances and radii in real-world settings.

Abstract

High-performance implementations of $k$-Nearest Neighbor Search ($k$NN) in low dimensions use tree-based data structures. Tree algorithms are hard to parallelize on GPUs due to their irregularity. However, newer Nvidia GPUs offer hardware support for tree operations through ray-tracing cores. Recent works have proposed using RT cores to implement $k$NN search, but they all have a hardware-imposed constraint on the distance metric used in the search -- the Euclidean distance. We propose and implement two reductions to support $k$NN for a broad range of distances other than the Euclidean distance: Arkade Filter-Refine and Arkade Monotone Transformation, each of which allows non-Euclidean distance-based nearest neighbor queries to be performed in terms of the Euclidean distance. With our reductions, we observe that $k$NN search time speedups range between $1.6$x-$200$x and $1.3$x-$33.1$x over various state-of-the-art GPU shader core and RT core baselines, respectively. In evaluation, we provide several insights on RT architectures' ability to efficiently build and traverse the tree by analyzing the $k$NN search time trends.

Arkade: k-Nearest Neighbor Search With Non-Euclidean Distances using GPU Ray Tracing

TL;DR

Arkade introduces two general reductions, Filter-Refine (FR) and Monotone Transformation (MT), to enable kNN queries with non-Euclidean distances to be accelerated on GPU ray-tracing (RT) cores, which traditionally optimize Euclidean metrics. FR decouples the search into a radius-based filtering step and a refinement step, mapping the process to RT-core BVH traversal and shader-based distance calculations for general , with correctness guarantees. MT handles distance functions whose geometry is not readily represented by RT objects by applying monotone transformations to preserve distance order, enabling an -based RT search on transformed data (e.g., cosine distance via normalization). Empirical results on a RTX 4060 Ti show substantial speedups (up to hundreds of times faster) over state-of-the-art baselines for several distances and datasets, while analyses highlight factors like BVH quality, ray-AABB intersections, and dataset distribution as key performance drivers. The work broadens the applicability of RT-core acceleration to low-dimensional, non-Euclidean kNN tasks and offers practical strategies for choosing distances and radii in real-world settings.

Abstract

High-performance implementations of -Nearest Neighbor Search (NN) in low dimensions use tree-based data structures. Tree algorithms are hard to parallelize on GPUs due to their irregularity. However, newer Nvidia GPUs offer hardware support for tree operations through ray-tracing cores. Recent works have proposed using RT cores to implement NN search, but they all have a hardware-imposed constraint on the distance metric used in the search -- the Euclidean distance. We propose and implement two reductions to support NN for a broad range of distances other than the Euclidean distance: Arkade Filter-Refine and Arkade Monotone Transformation, each of which allows non-Euclidean distance-based nearest neighbor queries to be performed in terms of the Euclidean distance. With our reductions, we observe that NN search time speedups range between x-x and x-x over various state-of-the-art GPU shader core and RT core baselines, respectively. In evaluation, we provide several insights on RT architectures' ability to efficiently build and traverse the tree by analyzing the NN search time trends.
Paper Structure (37 sections, 1 theorem, 7 equations, 7 figures, 4 tables, 1 algorithm)

This paper contains 37 sections, 1 theorem, 7 equations, 7 figures, 4 tables, 1 algorithm.

Key Result

Theorem 1

Given a training set of data points $A$, a set of query points $Q, q\in Q$, a natural number $k$, a positive real number $r$, and a distance function $D$, Algorithm alg:arkade computes the $k$ nearest data points of $q$ within a $D$-distance of $r$ from $q$.

Figures (7)

  • Figure 1: Euclidean and Angular distances: $a$ and $b$ are data points, $q$ is a query point, and $O$ is the point of reference. $L^2(q,a) < L^2(q,b) \centernot \implies \beta < \alpha$
  • Figure 2: RT-$k$NN reduction (right) finds all query points within radius $r$ to data point unlike the conventional $k$NN algorithm (left) that finds all data points within radius $r$ to the query point. Blue circles and red rhombus represent data and query points, respectively.
  • Figure 3: Filter-Refine: (a) map points to RT scene, (b) RT cores filter AABBs and shader cores filter geometric objects, (c) refine candidates to select $k=1$ nearest neighbors.
  • Figure 4: Arkade Monotone Transformation reduction: normalizing points for the cosine distance. Data and query points are marked with, blue and red colors, respectively. $L^2$-based Arkade FR reduction can only be applied after the Monotonic Transformation (normalization) to get the correct cosine distance-based $k$NN.
  • Figure 5: RT-$k$NN reduction can be extended to perform non-$L^2$-based $k$NN with a larger $r$ and $k$ using Inclusion property (Definition \ref{['def:inclusion']}).
  • ...and 2 more figures

Theorems & Definitions (8)

  • Definition 1: $k$-Nearest Neighbor Search
  • Definition 2: $r,D$-ball centered at a point $b$, $B_{D}(b,r)$
  • Definition 3: Filter
  • Definition 4: Refine
  • Theorem 1: Correctness of Arkade FR reduction
  • Definition 5: Monotonicity of distance functions
  • Definition 6: Arkade Monotone Transformation Reduction
  • Definition 7: $L^2$-inclusion property of distance $D$