Manuscript Offprint
arXiv:2610.37256Fast Approximate Line Nearest Neighbor Search
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Approximate nearest neighbor (ANN) search, which retrieves vectors close to a given query vector, is a fundamental operation in vector databases. However, emerging applications, such as selecting source images for photo-based animation and video synthesis, may require matching content while allowing a query-specified aspect contrast, such as an illumination change, to vary; a single query point does not directly express this requirement. In this paper, we study approximate line nearest neighbor (LANN) search, where an infinite query line removes the distance contribution along a specified direction while database records remain points. Prior approaches focus on top-1 search only for LANN and can incur high construction costs. Converting LANN into ordinary point ANN search through dimension lifting substantially increases index construction and query costs, while direct search on a proximity graph built for ordinary point ANN search can miss distinct regions close to a line. To address these issues, we propose LinePG, which enhances an existing proximity graph with pair edges to facilitate navigation between separated near-line regions. To find these pair edges efficiently, we first generate region pairs with spatial or graph separation, and near a line. We then score edges between the selected region pairs to guide the point endpoint selections. We conduct extensive performance studies and confirm the accuracy and efficiency of LinePG in comparison with the baseline approaches.
1 Introduction
Approximate nearest neighbor (ANN) search is a fundamental operation in vector databases [34, 35, 37, 40, 41]. Given a query vector, it retrieves data vectors that are close under a specified distance. Many approaches have been proposed for this ANN query, including proximity graph methods that navigate between nearby data points [3, 11, 17–19, 23, 27, 36, 42], which are among the state-of-the-art approaches for ANN search. However, emerging applications, such as visual media creation, introduce additional requirements for query processing. Google's Picasa included a Face Movies feature based on Exploring Photobios, which selects and orders photographs of the same person to create face animations [14]. Both Runway's Gen-4 References [28] and photo-based time-lapse mining [24] need to maintain subject or scene consistency while handling illumination differences in video-creation workflows. These workflows motivate retrieving content-consistent objects despite query-specified aspect changes. For example, when assembling a same-subject, same-pose face sequence across illumination changes for video generation, a user needs images that match the subject and pose while allowing lighting conditions to change. An ordinary ANN uses a query point for search, it does not explicitly specify which aspect variation should be disregarded, and can thus favor similar lighting over the characteristics the user wishes to preserve.

Find the same subject and pose across lighting changes.
Same subject + pose
Same subject, other pose
Other subject
Figure 1: A Case Study on YaleB Dataset
A directional model of the allowed aspect change provides a way to express this retrieval requirement. Image inversion maps real images to latent representations suitable for editing [32], while latent-direction studies identify approximately linear directions for selected facial-attribute changes [29]. A similar geometric formulation arises in query-side tangent-distance methods [15, 30], where a one-parameter image transformation is locally approximated by an affine line, and similarity to a fixed database vector is measured by its minimum distance to this line. These findings motivate representing a specified aspect change by an affine line , where z is an image code, u specifies the direction, and t controls the amount of change. For retrieval, the objective is to find existing images compatible with the specified variation; we therefore consider an infinite line query , which ranks database vectors by their minimum distance to the line without fixing the amount of change t. In the illumination example, two observations of the same subject and pose under different lighting conditions provide a query-specific secant direction through the difference between their embeddings. Fig. 1 illustrates this retrieval requirement on YaleB [7, 16]. The two query images show subject22 in pose00, with illumination azimuths of and , both at an elevation of . Using their 128-dimensional embeddings as the line endpoints, we compare exact top-5 retrieval over the same 16,126 candidate images, excluding both query images. Line retrieval returns five images matching both the query subject and pose, compared with two for either endpoint query and four for their midpoint. The line results span different lighting conditions, whereas the point-based alternatives also return images of other subjects or poses. In the figure, A/E denote illumination azimuth/elevation in degrees.
Motivated by these query requirements, in this paper, we study line nearest neighbor search. Given a dataset , a query is an infinite affine line through distinct endpoints . The search retrieves nearest data points of the query line , i.e., under the distance . The database continues to store one vector per record. The line specifies which component of the difference is not penalized. Due to the curse of dimensionality [10], the exact line nearest neighbor search is computationally intensive. We focus on the approximate line nearest neighbor search (LANN) in this paper, which has not been well studied. If all queries shared one direction, a fixed projection followed by ordinary point ANN would suffice. We consider varying directions and offsets, as in the endpoint-defined workloads, so one fixed projection cannot serve all queries.
In the literature, existing approaches for LANN is theoretical studies for top-1 search [2, 26]. They decompose vector data into dense near-line groups and a sparse residual set, but literal group construction is expensive, higher than quadratic in dataset size. Alternatively, existing point-to-hyperplane nearest neighbor search [9] provides an insight to solve LANN problem by lifting the vector dimension, and then converts the query into a point query in a higher-dimensional Euclidean space. However, we prove that the lowest dimension we need for LANN problem to solve in such a way is , which significantly increases the index construction and search cost due to the much larger dimension distance computation that is needed. Another idea is to reuse a proximity graph built for point ANN search and replace its point-to-point comparisons with point-to-line distances. The difficulty is that points close to one line need not be close to each other. They can occupy several regions separated along the line, while paths between those regions pass through points farther from the line. Hence, a search may find enough candidates in one region and stop before entering another region with better results.
In this paper, we propose LinePG, which constructs a line-enhanced proximity graph from an existing proximity graph built for point ANN search. The main contributions of this work are summarized below. ① We analyze why existing point-search structures can miss multiple near-line regions, motivating pair edges that connect separated regions close to a common line. These edges are used to enhance the original proximity graph to facilitate navigation between separated near-line regions. ② To find these pair edges efficiently and avoid examining all point pairs, we propose first finding promising pairs of regions. We introduce a balanced hierarchy that considers both vector locations and proximity graph connections to find spatially separated candidate regions, together with a quotient graph that identifies region pairs without short connecting paths. Next, a geometric score combines separation with support near a representative line to rank candidate region pairs. ③ We propose an edge-scoring mechanism to select pair edges, turning these region pairs into useful edges in the graph for navigation without increasing the total degree limit. It selects endpoints whose connecting direction is supported by multiple points in the target region and discourages directions redundant with existing or previously selected edges. The selected pair edges enhance the proximity graph, replacing retained original edges only when necessary to satisfy the total degree limit. ④ We further design a search algorithm for the line-enhanced proximity graph that uses selected pair edges as additional entrances into promising regions while avoiding redundant entrances into regions already being explored. ⑤ Experiments on six real-world datasets show that LinePG achieves 1.44–4.23x QPS of direct search on the original proximity graph when both methods reach at least 99% recall. On other datasets, LinePG can reach higher recall than 99%, while direct search can not. Compared with dimension lifting and existing theoretical methods, LinePG achieves QPS speedups of up to 976.17x and 1,665.63x, respectively, with much smaller index cost, at 100% recall on the N = 512 subsets.
The paper is organized as follows. Sections 2 and 3 define the problem and discuss existing approaches. Section 4 presents our design. Sections 5 and 6 give the region construction and candidate region pair selection algorithms. Section 7 describes search, followed by experiments in Section 8. Section 9 concludes this work.
Line ANN Search: Given a query line and a positive integer , line nearest neighbor search aims to find the points in closest to . We denote the set of these points as the line -nearest neighbors, , and their distances as . Since exact search is expensive, we study approximate line nearest neighbor (LANN) search in this paper. We denote the returned set by , and its distances by . Following existing point ANN studies [6, 22, 27, 39], we use recall to measure the retrieval quality of approximate LANN search: Recall@.
Point ANN Search and Proximity Graphs: For a query point , conventional point ANN search retrieves approximate nearest neighbors under . Graph-based methods [3, 6, 17, 22, 27, 38], which are among the state-of-the-art approaches for point ANN search, support this operation using a proximity graph . Each node in represents one database point, and an edge connects close points selected using point-to-point distances. We use the same symbol for a point and its graph node, and write for its out-neighbor list. A degree parameter controls the list size. The selected edges need not be exactly the nearest-neighbor edges: pruning and additional navigation edges also affect the topology [6, 22].


Figure 2: An illustration of main geometric notations
Figure 3: An example of a proximity graph
Point ANN search performs beam search on the proximity graph; it starts from one or more entry nodes and maintains a candidate pool containing at most nodes. It repeatedly expands the closest unexpanded candidate, evaluates its previously unseen out-neighbors, and retains the w closest candidates encountered. Search stops when no retained candidate remains to be expanded and returns the k closest retained points.
3 Limitations of Existing Approaches
In this section, we discuss the limitations of existing approaches to support LANN search.
Provable Line ANN Search: Andoni et al. [2] study LANN search with k = 1 from a theoretical perspective; we denote their approach as TheoryLP. Its objective is to return, with constant success probability, a point whose distance to the query line is within a factor of the optimum. Later work by Mulzer et al. [26] supports fixed-dimensional affine-flat queries, including lines, with improved space bounds. Both guarantees concern one returned neighbor.
At a high level, TheoryLP decomposes the dataset into dense near-line groups and a sparse residual set. Dense near-line groups are selected iteratively. In each round, TheoryLP examines axes through pairs of remaining data points, and chooses the axis with the smallest m-th point-to-axis distance, where m is of order . The points within this radius form a dense group, for which a Cylinder-DS is constructed to reduce line ANN search inside a dense cylinder to a small number of point ANN queries. For the points not handled by sufficiently thin cylinders, i.e., points in the sparse residual set, TheoryLP uses a Projection-DS, which randomly projects the data into a constant-dimensional space and reduces the resulting low-dimensional line nearest-neighbor problem to a geometric ray-shooting problem following Magen [20].
At query time, TheoryLP first uses the Projection-DS over the full dataset to obtain a coarse neighbor and estimate the relevant distance scale. It then queries the Cylinder-DS structures whose radii are sufficiently small relative to this estimate, while the remaining points are handled by a Projection-DS.
Issues: First, TheoryLP’s native result and approximation guarantee are designed for the case, rather than the objective considered here. Second, the literal cylinder selection is expensive in TheoryLP. If round contains active points, it evaluates axes against those points. With linear-time selection of each -th distance, the resulting work is for , for this selection procedure alone. This results in prohibitively high construction overhead. In our implementation, we extend TheoryLP to support by maintaining the nearest candidates among all data points evaluated during the search. Nevertheless, as shown in Exps. 1 and 2, its search efficiency remains substantially worse than that of the other approaches, even if its construction cost is much higher than others.
Direct Search on a Proximity Graph: A straightforward approach reuses a proximity graph built for point ANN search, as described in Section 2, but replaces the distance between two points with , the distance between a line and a point.
Issues: Closeness to the same line does not imply closeness to each other. For a line , let be a point's coordinate along , and let be its orthogonal residual. For any two points, . Points in can thus be arbitrarily far apart along , even though . However, in a proximity graph, edges connect nearby points [35, 37]. Hence, a proximity graph may connect such regions only through points farther from .
Example 3.1: Fig. 3 shows a proximity graph of with out-degree limit 3 (including edge without ), and unarrowed edges denote both directions. Consider the line and the set , with as the entry point. The points in form two regions in the induced graph: and . All directed paths from to pass through a point outside , since there is no edge from to . The beam search with terminates with , since expanding does not provide a better continuation, although 3-NN of are .
Hence, beam search on a proximity graph may terminate when finding enough candidates in one region, leaving better points in another region undiscovered.
Reduction via Quadratic Lifting: Inspired by the asymmetric quadratic transformation for point-to-hyperplane search [9], we consider converting LANN search into point ANN search via dimension lifting. Specifically, we first apply the same translation and uniform scaling to the dataset and query line so that every data point has norm at most one. This preserves point-to-line distance rankings. For simplicity, we reuse p, a, u for normalized coordinates, with the transformed line query expressed in canonical form.
Let , , and . Write for Frobenius-orthonormal coordinates of traceless symmetric matrices; this block has entries. We map each data point and query line to , and . Both vectors have dimensions. Since and , their squared Euclidean distance satisfies . For a fixed query, preserves the exact nearest-neighbor ordering. We can therefore build a point ANN index over and query it with . The following theorem shows this construction uses the minimum dimension in the stated exact-reduction model.
Theorem 3.1: Let and let have nonempty interior. Any fixed maps and satisfying , for all and all affine lines require . The construction attains this bound on the unit ball.
Proof Sketch: Modulo constants, the squared line-distance functions span the -dimensional space of quadratic and linear polynomials: for , the matrices span all symmetric matrices (their sum over coordinate directions is ), and varying supplies all linear terms. Expanding , with , gives , hence . Equality gives , making every and polynomials of degree at most two on the open set. If is the homogeneous quadratic part of , the quartic part of is . Thus all vanish, every is affine, and , a contradiction.
Issues: The issue is the substantial dimensionality increase introduced by quadratic lifting. The dimension-optimal exact lifting still has dimensions. Thus, the lifted vectors require storage. More importantly, applying a conventional point ANN index in this lifted space substantially increases both index construction and query costs, since distance evaluations and graph construction operate over the much higher-dimensional representations. As shown in Exps. 1 and 2, this dimensionality expansion leads to significantly higher construction overhead and substantially lower query efficiency than searching in the original space.
4 Line-Enhanced Proximity Graph
Section 3 identifies three limitations. Enumerating all point pairs to construct line-specific structures is expensive, and quadratic lifting increases the dimension of every distance computation. Moreover, reusing a proximity graph for LANN search is difficult, since points close to one line may occupy several regions, whereas the graph mainly connects nearby points. Thus, a beam search can explore one region and stop before reaching another. To address these issues, we design a line-enhanced proximity graph, which reuses the original proximity graph and enhances it with a limited number of connections between regions.
Connect Near-Line Regions: Our key idea is to use original edges in the proximity graph for local exploration and add pair edges to reach other near-line regions. Within a small region, points are close to each other, and the proximity graph already provides useful local connections. The missing connection is often between two regions far apart along the line. When two regions are close to a query line but far apart, we can find a line linking them with a direction highly similar to the query line. To see this, let distinct and let be the query direction. Since , its perpendicular component has norm at most . Thus, . When the two points are far apart relative to , i.e., , their secant is nearly parallel to . For example, in Fig. 3, the line between and has a direction highly similar to .
We therefore consider using these edges between two near-line regions, named pair edges, to provide an alternative route. On the original proximity graph, reaching a different near-line region may require intermediate points that are farther from the line and are rejected by the beam search. A pair edge provides an alternative to this detour; local exploration resumes through ordinary edges at its


Figure 5: Hierarchy of Fig. 4


Figure 4: Region partition Figure 6: Quotient graph
Figure 7: Candidate arc in Fig. 6
target. For example, reconsider Example 3.1 and Fig. 3. Adding a pair edge gives the search from access to , and expanding finds and . To keep the line-enhanced proximity graph within the degree limit , adding pair edges may require pruning some original edges in the proximity graph, e.g., we substitute the edge with the edge in Fig. 3 to maintain the degree limit of 3.
Let be the original proximity graph. A pair edge is an added edge between points in two selected regions. Let be these edges and be the retained original edges. The line-enhanced proximity graph is .
However, to construct a line-enhanced proximity graph, there are potential point pairs to form pair edges. Evaluating them individually is costly; we thus group points into regions and first select potential region pairs via the hierarchy and quotient graph.
Region Pairs on Hierarchy: We construct a balanced hierarchy using both the vectors and the original proximity graph. Vector geometry groups points at a local spatial scale. Graph smoothing adjusts the split values so that neighboring points influence each other's assignment. Figs. 4 and 5 show the complete hierarchy for the example in Fig. 3. The root first splits into and . Each has eight points and is split once more. The left child gives and , and the right child gives and . Each internal node in the hierarchy represents a region of points which is the disjoint union of its two children. Leaves partition the whole dataset, so every point has exactly one owner , e.g., and .
As discussed before, we aim to find pair edges that link regions close to a line yet far apart, and far-apart regions close to the same line have a common approximate direction. Different subtrees provide candidate spatial alternatives, but do not by themselves guarantee separation or proximity to a common line. Therefore, we use the hierarchy to first propose partners from different sibling subtrees, e.g., for node in the hierarchy, its sibling is , and its parent's sibling is , containing , . A score then compares separation against local spread and support near the representative secant. The details are given in Section 6.2.
Region Pairs on Quotient Graph: Based on the hierarchy, we then construct a quotient graph: each leaf becomes a vertex, and an arc records an original edge between two different leaves. Thus, the quotient graph exposes how the original graph connects those regions. For example, Fig. 6 shows the four leaves from Fig. 5. Its arcs are , , , and . Each double arrow stands for two directed arcs, e.g., the four edges from to include and ; they give one arc. We next use quotient graph topology to propose region pairs without a short directed route between them. Such pairs can expose detours worth shortening. For instance, Fig. 7 illustrates how a connection can shorten an inter-region detour. However, the existence or length of a quotient route says nothing by itself about its point-to-line distances. The same score, based on geometric separation and local spread and support near the representative secant, is thus evaluated to identify the region pairs.
Therefore, for selecting candidate region pairs, the hierarchy exposes spatial alternatives at several scales, and the quotient graph exposes how the original graph connects those regions. Sections 5 and 6.1 give the construction and candidate-generation details.
Pair Edge Selection: A retained candidate region pair must next become an actual edge , for and . Using only the centroid of for every node could concentrate entrances at one point and miss useful endpoint alternatives. We therefore form a small representative bank for each leaf: points nearest , followed by a bounded number of farthest distinct points. Then, for each point , we consider selecting edges from to nodes based on the following rules.
(1) The selected regions A and B are separated; as discussed above, next, they should be close to a line, i.e., a useful pair edge should follow a direction that is supported by multiple points in the target region. Hence, for a candidate line where , we use to evaluate if other points in B support the line. Here where is the normalized squared distance from z to the line through p and y. A larger indicates that the direction is supported by more points in the target region. Among the candidate endpoints examined for the same target region B, we prefer the valid endpoint with the largest . An endpoint is valid only if and its edge belongs to neither the original edge set E nor the current . For example, reconsider Fig. 4, where and . Assume here is . We have , , and . Thus is selected, since it receives the largest support, as shown in Fig. 3.
(2) After choosing an endpoint for each candidate target region, we further discourage pair edges whose directions are redundant with either previously selected pair edges or the original proximity graph. Let denote the squared cosine similarity between and , with for a degenerate direction. (i) For selected pair edges, use , where contains the pair endpoints already selected for . A large therefore indicates that the candidate introduces a direction different from those already selected for . (ii) For the original proximity graph, use , where contains the existing neighbors of in forward half-space of . Thus, a large value means the edge direction is poorly represented by existing edges.
Algorithm 1 gives the construction of line-enhanced proximity graph . Given a proximity graph with degree limit M built for
Algorithm 1: BuildLPG (P, G, )
Input : dataset P, proximity graph with degree limit M, and pair edge limit
Output : line-enhanced proximity graph
1 the hierarchy built based on P and G; // Section 5
2 the quotient graph of T, where and ;
3 SelectRegions ( ); // Algorithm 2
4 ;
5 for each do
6 for each do
7 ;
8 ;
9 if the edge count from p in exceeds then
10 Remove with minimum from ;
11 if the edge count from p in exceeds M then
12 Remove with maximum from ;
13 return
point ANN search and a pair-edge limit , we first build the hierarchy and quotient graph to select candidate region pairs (lines 1-3). For each point in a source region (lines 5-6), we select a target endpoint maximizing from the representative bank of the target region (line 7) and insert it into pair edge set (line 8). When the newly selected pair edge leads to exceeding the degree limit, we remove the edge based on direction diversity scores and if the pair-edge count exceeds (lines 9-10), or prune the longest original edge otherwise (line 11-12). Note that the edges selected in proximity graph G are already pruned by RNG pruning strategy [22], hence, we only need to prune the longest distance edge to satisfy the degree limit here. The resulting graph is (line 13).
5 Hierarchy and Quotient Graph Constructions
In this section, we give the construction details for the hierarchy and quotient graph Q introduced in Section 4.
The hierarchy is built by recursive balanced partitioning. Before each split, we smooth a scalar split signal derived from the vectors over the original graph, so that the assignment reflects both point locations and local graph connections.
Partition via Graph Smoothing: For a hierarchy node containing point set , let be its centroid, and choose the coordinate of maximum variance, . The initial split value of is . Partitioning these values at the median gives a balanced vector-based geometric split. Intuitively, this cuts region at its median along the coordinate axis of greatest spread.
To account for the proximity graph, we consider the subgraph induced by C. Specifically, neighbors in contribute to the split value of . For an edge in this subgraph, define , where is the mean squared distance to the centroid. Shorter edges therefore receive larger weights. For each with a nonempty induced neighbor list,

(a) Vector-based median split
(b) Partition after graph smoothing
Figure 8: An example of region partition
normalize over : , and set all other entries to zero. If , use equal weights on the existing induced edges. If , set . These conventions keep every row sum equal to one.
At each round , update . The updates use the values from the preceding round. They change only the split signal, not the point coordinates or graph edges. The following theorem formalizes how smoothing encourages neighboring points to have similar split values.
Theorem 5.1: Let be the row-stochastic matrix above, and let be any stationary distribution of , i.e., , , and . The stationary mean is preserved. For , each smoothing round satisfies . Moreover, every new split value lies between the minimum and maximum values of preceding round.
Proof Sketch: Stationarity gives . Put , and write and . By Jensen's inequality [5], the unit row sums of , and stationarity, . Also, expanding the weighted edge differences gives . Combining these identities with the update yields . Subtracting a common mean does not change pairwise differences, giving the stated bound. Finally, each new value is a convex combination of the preceding values, so it lies within their range.
Iterating smoothing to convergence can suppress the geometric information in the initial split signal. In particular, when the induced graph is strongly connected, the values converge to the same stationary mean, losing their geometric separation. We thus use a small number of rounds, with by default in Section 8.
Example 5.1: Reconsider the right subtree in Fig. 5. Fig. 8 compares two splits of this same parent. Its maximum-variance coordinate is y. A raw median split, i.e., split via the horizontal line (the dashed purple line in Fig. 8(a)), places in the lower child and in the upper child, since 's y coordinate is smaller than 's. After smoothing, their assignments are exchanged. Thus is grouped with its neighbor , while is grouped with and . The number of directed edges crossing this split decreases from nine to four, as highlighted in dashed red lines.
Hierarchy Construction: After smoothing, order points in C by , and split at the median. The two children contain and points. Recursive partitioning starts at and continues until every leaf contains at most points. We set by default in Section 8, whereas the example shown in Fig. 5 uses .
Quotient Graph Construction: Once the hierarchy is built, we can obtain the leaf-owner record for each point in . Next, we can construct the quotient graph by scanning the original edges. Specifically, for each , add the arc when , then remove duplicate arcs. Multiple point edges therefore give only one quotient arc. This produces Fig. 6 without rebuilding a proximity graph for any leaf. Note that the averaging weights in W are not used as quotient-arc weights: Q records only the original inter-leaf connections.
We next analyze the cost of constructing the hierarchy and quotient graph. Let and be the number of hierarchy levels. Using linear-time median selection for the balanced split [4], the hierarchy construction takes time. Computing centroids, coordinate variances, and mean squared spreads costs per level. Using sparse neighbor rows, forming and normalizing the geometric edge weights costs at most ; these weights stay fixed during the rounds at that node. Each round costs per level, and median partitioning costs . Quotient construction takes expected time using hash-based deduplication. Hence, the total cost of constructing the hierarchy and quotient graph is .
6 Candidate Region Pair Selection
Section 4 gives the endpoint score J, the directional factors , , and the edge-replacement procedure. What remains is to identify the region pairs supplied to that procedure. To generate candidate region pairs, we first generate candidates from T and Q, then retain those with high geometric separation and secant support. The selected region pairs are finally converted into point-level edges.
6.1 Candidate Region Pairs
As discussed in Section 4, candidate region pairs are generated from the hierarchy T and quotient graph Q, which both return ordered pairs of distinct leaves.
Pairs from Sibling Subtrees on Hierarchy: We use the internal hierarchy nodes to organize the search for partners, and use to limit the number of leaves sampled from each sibling subtree. Specifically, as shown in Algorithm 2, for a source leaf A, start at and move toward the root (lines 15–19). At each nonroot node , let be its sibling and its descendant leaves. Select leaves uniformly without replacement from and add them as candidate target regions of A. Thus, a small sibling subtree contributes all its leaves; a large one contributes only a sample. The same per-subtree budget prevents the many leaves at a coarse level from exhausting the candidate generation work. Different sibling subtrees along this path are disjoint and together contain all leaves other than A. To perform this sampling without enumerating a large subtree on every visit, a depth-first traversal first numbers the leaves and records the contiguous interval of leaf ranks of each node (line 1). Then, at line 18, we can draw distinct ranks uniformly from that interval and return the corresponding leaves. For example, reconsider source in Fig. 5 with . Its sibling is , so the first step adds . After moving to , the sibling is , whose leaf interval contains , . It then chooses either or , each with probability 1/2.
Pairs Beyond Short Quotient Paths: A useful candidate region pair should not merely repeat a connection available through a few region transitions. Let be the shortest directed hop distance from to , taking value when no path exists. For a positive hop radius and leaf set , define , . Only leaves in are eligible for the quotient source. This criterion has a direct connection to the original proximity graph. Any path in from to induces a walk in with no more edges, after consecutive repetitions of leaf identifiers are removed. Thus, rules out every original point-graph path of at most edges between the two leaves. An added edge provides a one-step alternative. We use the same parameter to bound the candidate region pairs for each leaf node . Each region will generate at most region pairs, such that the number of region pairs from the hierarchy and the quotient graph have the same scale. Due to the small-world diameter in proximity graphs [21, 22, 25, 35], does not have to be large, we set by default.
Exactly obtaining the set for each leaf is costly, although only a few targets in are needed. Therefore, as shown in Algorithm 2, we reverse this order: instead of first obtaining and then sampling from it, we first draw one shared pool of distinct leaves uniformly from (line 3) and then determine only which members of are reachable within hops. We use by default to provide sufficient candidate regions for each leaf node. We use one bit per node in , where bit of records whether is reachable from in at most hops. Initialize it to one exactly when (line 5), and perform synchronous updates: (lines 6-10). A row reads its outgoing neighbors' previous masks, preserving the direction ; two buffers prevent a newly written value from propagating twice in one round. The zero bits at valid target positions of the final mask identify (line 13), and then we can independently select a uniform subset of size from as the candidate target regions for (line 14). This uses the bit-parallel traversal principle in [31], but applies it only to sampled targets. The following theorem proves that sampling targets before checking short-hop reachability does not favor any eligible leaf when the randomness of is included.
Theorem 6.1: Fix a source with . For every possible returned size and every , , where the probability includes both the random pool and the subsequent subsampling, and the conditioned event has positive probability.
Proof Sketch: Fix and write and . For any two leaves , consider the permutation that exchanges their
Algorithm 2: SelectRegions (T, Q)
Input : hierarchy T, quotient graph Q Parameter : budgets , hop radius , and region pair limit r Output : ordered list C of selected region pairs
1 Number leaves by DFS; store each subtree's leaf interval; 2 ; ; 3 a uniform -subset of , in random order; 4 a zero -bit mask for each leaf Z; 5 Set bit j of to one for each ; 6 for to do 7 for each leaf Z in Q do 8 ; 9 for each do ; 10 Swap mask arrays and ; 11 ; 12 for each leaf A in identifier order do 13 ; 14 a uniform -subset of ; 15 ; ; 16 while v is not the root do 17 the sibling of v; 18 Sample leaves in the subtree rooted at u to insert into ; 19 the parent of v; 20 Deduplicate ; remove A; 21 Append up to r pairs (A, B) to C in descending ; 22 return C
identifiers and fixes every other leaf. Since is uniform among subsets of the prescribed size, applying this permutation leaves its distribution unchanged. It also preserves , hence the returned size . Conditional on any pool, the subsequent subsampling is uniform within . Exchanging thus exchanges their inclusion events without changing their probabilities or the event . For every possible , all eligible leaves consequently have the same conditional inclusion probability; denote it by . As , . Thus . The probability averages over both random stages; it is not a uniformity claim after fixing , nor after the later score-based top- selection. Sharing can also correlate the samples of different sources.
Merging the Candidate Region Pairs: As shown in Algorithm 2 and discussed above, each leaf A generates a candidate set from the hierarchy (line 18) and the quotient graph (line 14). The two sources express different preferences: the hierarchy offers spatial alternatives at several scales, while the quotient sample offers destinations without short directed routes. We deduplicate the union of these two sets (line 20), and each candidate will be scored (line 21), as described in Section 6.2. The best region pairs will be returned to generate pair edges (lines 21-22).
6.2 Scoring Candidate Regions
After obtaining the candidate region pairs, we consider scoring them based on geometric considerations from Section 4: a pair

(a) and :

(b) and :
Figure 9: An example of representative secants
edge should span more than the local extent of its regions, and this connection should describe a direction supported by the regions' points. We use for the first consideration and for the second. For each final leaf , compute its centroid and mean squared spread from the original vectors, as in Section 5. The representative secant of is the infinite line through the two centroids: . The Euclidean distance between these centroids is , which measures the separation of the regions' representative locations.
Separation Relative to Local Spread: A large centroid distance alone is insufficient, since two large regions may have distant centroids without being well separated at their own scale. We thus compare with , the combined mean squared spread. Define . Equivalently, is one divided by one plus the spread-to-separation ratio. It approaches one when separation dominates local spread, i.e., , equals when these squared scales are equal, and is small when the regions' spread dominates.
Example 6.1: Reconsider Fig. 4, where , and . We have , , , and . Thus , , and . Similarly, we have . Thus, is larger than , which means the connection to spans more of the space relative to the two regions' extents.
Support for the Representative Secant: Any two distinct centroids define a line, even when their surrounding points are spread away from it. For each actual point , we therefore measure its squared perpendicular distance to relative to and average its contribution: . A point on the secant contributes one; at perpendicular distance it contributes 1/2; and the contribution decreases smoothly with distance. Normalizing by compares transverse deviation against the same longitudinal scale used by . The average avoids preferring a pair merely because its leaves contain more points. Whereas uses total spread, specifically measures spread perpendicular to the proposed line.
Example 6.2: Reconsider Example 6.1. Fig. 9 shows the two centroids, their secant, and example perpendicular residuals. In Fig. 9(a), and have perpendicular distances approximately 0.10 and 1.14 to this line. Thus, is much closer to than and therefore contributes more, i.e., their contributions to h are approximately 1.00 and 0.77. Summing the contributions of all eight points gives 7.42; dividing by eight gives . Similarly, in Fig. 9(b), we have .
Combining the Considerations: We retain the product , setting when the centroids coincide. Both terms lie in , and S cannot exceed either term. Thus, a large value requires both appreciable separation and secant support, rather than allowing one to compensate without limit for the other.
Example 6.3: Reconsider Examples 6.1 and 6.2 with . We can compare all three possible target regions of : for , , , thus ; for , and , thus ; and for , and , thus . The scores show why support is not sufficient alone: gives the highest for source , but its lower separation factor makes it a less preferred partner than .
Time Complexity: Each source has candidates, since the hierarchy has levels. On a 64-bit machine, synchronous propagation takes time [31]. Decoding proposals costs , each region score costs , and retaining the best with a bounded heap costs per candidate. With cached leaf statistics and expected constant-time hash deduplication, Algorithm 2 thus takes .
7 Search on the Line-Enhanced Graph
In this section, we introduce the search algorithm on the line-enhanced proximity graph. We search based on the beam search introduced in Section 2. The candidate pool has beam width and is ordered by point-to-line distance. During search, edges in are explored first; pair edges provide additional entrances when the current frontier does not already contain a closer continuation.
Local Exploration: Let be the candidate pool, Visit the points whose distances have been evaluated, and Done the leaves containing an expanded point (line 1). The pool keeps at most points, including expanded points; each newly retained point is unexpanded. Initially, we evaluate an entry point and insert it into and Visit (line 2). Each iteration selects the closest unexpanded point (line 4), marks it expanded (line 5), and examines its retained original neighbors (lines 6-7). The farthest point from will be iteratively removed until the size of is no more than (line 8). Let be the unexpanded points now in (line 9). If some satisfies , the frontier already offers progress and we skip the pair edges of for this expansion (line 10).
Exploration through Pair Edges: Otherwise, we consider the pair endpoints x of p in stored order, i.e., ordered by decreasing as discussed in Section 4 (line 11). An endpoint is skipped if its distance is already known or its owner leaf belongs to
Algorithm 3: SearchLPG
Input : line-enhanced graph with leaf-owner map , query line , result size , and beam width
Output : approximate nearest points to
1 ; Visit ; Done ;
2 the entry point of ; ; Visit ;
3 while there is an unexpanded point in do
4 the closest unexpanded point to in ;
5 Mark expanded; Done Done ;
6 for each do
7 if Visit then ; Visit Visit ;
8 while do remove the farthest point from in ;
9 the unexpanded points in ;
10 if some satisfies then continue;
11 for each in stored order do
12 if Visit and Done then
13 ; Visit Visit ;
14 while do remove the farthest point from in ;
15 return the closest points to in
Done. The leaf test avoids repeated entrances into a region already being explored. Other endpoints are evaluated and inserted into (line 13). Similarly, we iteratively remove the farthest nodes from in to ensure (line 14). Finally, the closest points to in are returned (line 15).
Example 7.1: Reconsider Fig. 3 with and . After considering the retained original neighbors , the closest unexpanded candidate is at distance approximately 0.70, larger than . Pair exploration is thus allowed. Since has not been expanded, enters the pool at distance approximately 0.24. Its original neighbors subsequently provide , yielding .
8 Experiments
Datasets: We employ 6 real-world public datasets for evaluation. The datasets are summarized in Table 1. Each query contains two -dimensional endpoints encoding one infinite line.
YaleB and Multi-PIE provide controlled variation in face appearance. YaleB release documents 28 subjects, nine poses, and 64 illumination conditions [7, 16]; Multi-PIE documents 337 subjects, multiple sessions, 15 viewpoints, and 19 illumination conditions [8]. For both YaleB and Multi-PIE, we generate their vector representations using a 128-dimensional principal component analysis embedding, following the classical eigenface representation [33]. For YaleB, its queries are generated by considering varying illumination while holding the subject and pose fixed. That is, for each subject–pose group, we select two images as observations under different illumination conditions, define a line through their embeddings as a query. Using one pair per group and excluding all 504 endpoint images leaves 15,624 base vectors and yields 252 query lines. For Multi-PIE, its queries are generated by varying illumination while holding the subject, recording session, viewpoint, and expression fixed. Specifically, for each subject–session–viewpoint–expression group, we select two images acquired under different illumination
Table 1: Statistics of Datasets
| Datasets | N | d | #queries | Source |
|---|---|---|---|---|
| YaleB | 15,624 | 128 | 252 | [7, 16] |
| CelebA | 60,000 | 512 | 1,000 | [12] |
| FFHQ | 70,000 | 512 | 1,000 | [13] |
| Multi-PIE | 246,012 | 128 | 6,474 | [8] |
| SIFT | 1,000,000 | 128 | 10,000 | [1] |
| GIST | 1,000,000 | 960 | 10,000 | [1] |
conditions as the query endpoints. Using one pair per group and excluding all 12,948 distinct endpoint images leaves 246,012 base vectors and yields 6,474 query lines.
CelebA is introduced with progressive GAN training [12], and FFHQ is introduced with StyleGAN [13]. For both datasets, we use the e4e inversion encoder [32] to map real images into the latent space of a pretrained StyleGAN model and derive a 512-dimensional representation from each inverted code. For these two datasets, their queries are constructed from an image representation and a nonzero semantic direction in the same representation space, motivated by approximately linear facial-attribute editing in GAN latent spaces [29]. Specifically, the endpoints and encode the query line . We generate 1,000 query lines for each, providing additional real-image workloads for evaluating retrieval along semantic directions in a learned latent space.
SIFT and GIST are standard vector-search benchmarks consisting of image descriptors and are widely used in point ANN search studies [27, 35]. We retain the released base vectors and construct line queries from the released point-query sets. Specifically, we uniformly sample 10,000 pairs of query vectors and define each query line as the infinite line passing through the sampled pair.
Algorithms: We compare our approach, named LinePG, with four baselines: TheoryLP [2], Lift, DirectSearch, and BruteScan. For each algorithm, we try to tune the parameters for index construction for a Pareto-optimal recall-QPS curve. For fair comparisons, the graph-based approaches, i.e., Lift, DirectSearch and LinePG, use HNSW [22] with the same construction settings, and , and match the insertion order and construction seed.
(1) TheoryLP implements the algorithm introduced in [2], with dense-group size , approximation parameter , exponent , and projection dimension . To support top- retrieval, we execute one native query pass and retain the closest points, under the original point-to-line distance, among all evaluated database points. We include TheoryLP only in the small-base comparison because of its construction cost.
(2) DirectSearch uses the original proximity graph and evaluates candidates via beam search with point-to-line distance, as introduced in Section 3. (3) Lift uses the vector representation with coordinates for index construction and search, as introduced in Section 3. It builds a separate HNSW index over the lifted vectors, while using the same HNSW construction parameters as DirectSearch. (4) BruteScan directly evaluates for every and returns the smallest distances. It has no index or search-width parameter and provides an exact-search timing reference at recall one. (5) LinePG enhances the same used by DirectSearch, with total degree limit and pair-edge limit . Unless stated otherwise, we set the leaf capacity , smoothing rounds , sampling budget , quotient-hop
DirectSearch Lift TheoryLP BruteScan LinePG

(a) YaleB

(b) CelebA

(c) FFHQ

(d) Multi-PIE

(e) SIFT

(f) GIST

(g) YaleB

(h) CelebA

(i) FFHQ

(j) Multi-PIE
(k) SIFT

(1) GIST
Figure 10: Search performance comparisons on full datasets (Exp. 1)
DirectSearch Lift TheoryLP BruteScan LinePG

(a) YaleB

(b) CelebA

(c) FFHQ

(d) Multi-PIE
(e) SIFT

(f) GIST
Figure 11: Search performance comparisons on N = 512 subsets (Exp. 1)
radius , and retained region partners . Each representative bank of leaf nodes contains up to eight members nearest its centroid and up to four farthest remaining members.
Performance metrics: Following existing vector search works [9, 17, 27, 35, 39], we employ QPS (Queries Per Second) to measure efficiency and use Recall to show the accuracy. QPS is the quantity of queries processed per second, while Recall is defined in Section 2. Experimental environments: The experiments are conducted on a CentOS Linux server with Intel(R) Xeon(R) Silver 4215 CPU @ 2.50GHz with 128GB memory. All algorithms are implemented in C++17. The code is compiled with g++ 11.5.0 under O3 optimization.
For index construction, we report the index time and size on the same machine using multiple threads. For vector search, we set by default and evaluate the performance of the search algorithms using a single thread following [9, 27, 35, 38], and incrementally adjust parameters within the search algorithm to achieve the desired recall in the experiments.
Exp. 1: Search Performance Comparison. Figs. 10 and 11 compare LinePG with DirectSearch, Lift, and BruteScan on the full datasets with and the subsets with , respectively. The results show that LinePG improves query efficiency at high recall while also extending the recall attainable by direct graph search. TheoryLP is evaluated only on the small bases due to its high index construction cost, as shown in Exp. 2. For full-set Lift, construction times out after two hours on CelebA, SIFT and GIST, and runs out of memory on FFHQ. It completes on YaleB and Multi-PIE, as reported in Table 2.
On the full datasets, we first compare QPS when recall is at least 0.99. For , LinePG achieves QPS speedups of 4.23x, 2.00x, 2.14x, and 1.55x over DirectSearch on YaleB, CelebA, FFHQ, and Multi-PIE, respectively. For , the speedups are 2.44x, 1.86x, 1.71x, 1.44x, 1.67x, and 2.15x on YaleB, CelebA, FFHQ, Multi-PIE, SIFT, and GIST, respectively. DirectSearch does not reach 0.99 recall on full SIFT or GIST for within the tested search range. Importantly, the efficiency advantage is not obtained by sacrificing retrieval quality. For example, LinePG attains reported recall 1.0 for both values of on full YaleB, CelebA, FFHQ, and Multi-PIE. On SIFT, its highest observed recalls are 0.9993 and 0.9994 for and 100, respectively, whereas DirectSearch reaches only 0.9893 and 0.9924. On GIST, the highest observed recalls of LinePG are 0.9997 and 0.9995 for and 100, respectively, whereas DirectSearch reaches only 0.9899 and 0.9948. Moreover, higher efficiency and higher recall can be achieved simultaneously, e.g., on SIFT with , LinePG obtains 0.9958 recall at 613.11 QPS, while the highest-recall tested configuration of DirectSearch obtains 0.9893 at 13.70 QPS. This is 44.76x higher throughput with better recall, not an equal-recall interpolation. At the same reported recall of 1.0 on full YaleB, LinePG also outperforms Lift by 63.18x and 63.34x for and 100, respectively.
On the N = 512 subsets, LinePG reaches reported recall 1.0 on all six datasets. At this same recall, its QPS is 1.56x, 1.81x, 1.85x, 1.57x, 1.57x, and 1.76x that of DirectSearch on YaleB, CelebA, FFHQ, Multi-PIE, SIFT, and GIST, respectively. Its speedups over Lift range from 77.73x on SIFT to 976.17x on GIST, with the same recall. Compared with TheoryLP, LinePG is 431.80x, 1,665.63x, 604.74x, 90.15x, 257.92x, and 551.81x faster on YaleB, CelebA, FFHQ, Multi-PIE, SIFT and GIST, respectively, again at reported recall 1.0. Together, these results demonstrate a favorable high-recall QPS tradeoff on both the full and small bases.
Exp. 2: Index Size and Construction Time. Table 2 compares the
Table 2: Index construction cost comparisons (Exp. 2)
| Scale | Dataset | Index Construction Time (s for Full, ms for N = 512) | Index Storage (MiB for Full, KiB for N = 512) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TheoryLP | DirectSearch | Lift | LinePG | TheoryLP | DirectSearch | Lift | LinePG | |||||
| Total | H+Q | Region | Edge | |||||||||
| Full | YaleB | - | 0.630 | 177.758 | 4.957 | 0.168 | 0.070 | 4.089 | - | 8.799 | 500.86 | 9.199 |
| Multi-PIE | - | 21.829 | 5,827.460 | 87.821 | 5.685 | 1.061 | 59.246 | - | 143.334 | 7,890.53 | 148.503 | |
| FFHQ | - | 44.592 | oom | 74.171 | 2.100 | 0.458 | 27.021 | - | 147.348 | oom | 147.408 | |
| CelebA | - | 17.967 | oot | 38.907 | 1.344 | 0.255 | 19.341 | - | 124.468 | oot | 125.138 | |
| SIFT | - | 366.553 | oot | 721.441 | 80.920 | 11.645 | 262.323 | - | 642.201 | oot | 642.241 | |
| GIST | - | 2,271.748 | oot | 2,527.428 | 51.249 | 13.015 | 191.416 | - | 3,767.079 | oot | 3,773.679 | |
| N = 512 | YaleB | 144,413 | 19.93 | 8,350 | 61.89 | 4.35 | 4.02 | 33.58 | 465.51 | 290.91 | 17,075.93 | 303.28 |
| Multi-PIE | 144,242 | 19.21 | 8,262 | 50.91 | 4.34 | 3.19 | 24.18 | 465.59 | 293.88 | 17,079.24 | 305.05 | |
| FFHQ | 559,685 | 34.11 | 146,241 | 61.63 | 12.29 | 4.03 | 11.20 | 1,416.59 | 1,066.62 | 264,718.30 | 1,071.17 | |
| CelebA | 559,078 | 34.90 | 144,678 | 74.91 | 12.29 | 3.91 | 23.81 | 1,416.56 | 1,063.35 | 264,715.50 | 1,073.64 | |
| SIFT | 144,485 | 19.64 | 8,992 | 51.02 | 5.09 | 3.73 | 22.56 | 465.59 | 295.43 | 17,079.29 | 306.29 | |
| GIST | 983,791 | 52.25 | 447,206 | 90.40 | 19.90 | 3.43 | 14.82 | 2,526.09 | 1,961.37 | 926,430.33 | 1,965.77 | |
Add pair edges with pruning Additional pair edges No pair edge

(a) YaleB

(b) Multi-PIE
(c) SIFT
Figure 12: Ablation study for pair edges in indices (Exp. 3)
index sizes and construction times of different approaches in Exp. 1, where “-” in the table denotes TheoryLP is not tested, oom and oot denote the out-of-memory failures and timeouts as discussed.
For index time, Table 2 further breaks LinePG's construction into HNSW (the time is the same as DirectSearch), hierarchy and quotient construction (denoted as H+Q), candidate region pair generation (denoted as Region), and pair edge selection and addition (denoted as Edge). Compared with DirectSearch, on GIST, these latter three stages add 255.680 s to the 2,271.748 s HNSW build, for a total of 2,527.428 s. Pair edge selection dominates these three additional stages, accounting for 73.9–94.5% across the full datasets. Compared with two other baselines, the index construction time of LinePG is significantly smaller than Lift and TheoryLP.
For index size, we report the total storage required for retrieval, including the original base vectors and the method-specific index structures. Since DirectSearch uses the original HNSW graph, we report its HNSW size. Our method enhances the HNSW; Table 2 reports its total index size, including HNSW, changed edge lists, and leaf-owner labels. On the full datasets, LinePG occupies 1.000–1.046 times the total storage of DirectSearch, e.g., its SIFT totals are slightly larger with an almost zero increase. At N = 512, the indices of LinePG are much smaller than TheoryLP and Lift.
Exp. 3: Ablation Studies. We evaluate the following three ablations on the full YaleB, Multi-PIE, and SIFT datasets with . Exp. 3-1: Effectiveness of Pair Edges. Fig. 12 compares three approaches: ① Add pair edges with pruning (LinePG), which inserts at most pair edges per point and prunes original edges when the total degree would exceed ; ② Additional pair edges, which uses the same pair-edge budget without removing original edges, allowing a degree up to ; and ③ No pair edge (DirectSearch), which retains the original graph.
LinePG Pair edge first Normal pair edge No leaf gate Pair edge last

(a) YaleB
(b) Multi-PIE
(c) SIFT
Figure 13: Ablation study for search algorithm (Exp. 3)
On SIFT, ③ reaches a maximum recorded recall of 0.9893, compared with 0.9982 for ② and 0.9993 for ①. The two enhanced variants thus extend the measured high-recall range. The benefit of retaining every original edge depends on the operating point. At the 0.99 recall target, ① is faster than ② on YaleB and Multi-PIE, whereas ② is faster on SIFT. This advantage reverses at the 0.995 target on SIFT, where ① achieves 3.38x the QPS of ②. Pruning is also faster at the same recorded recall of 1.0 on YaleB. Thus, neither strategy consistently dominates, but both improve upon the original graph, and replacement maintains the degree bound without preventing high-recall retrieval. For ②, construction takes 4.961, 87.816, and 726.490 seconds, with index sizes of 9.57, 155.29, and 647.76 MiB on YaleB, Multi-PIE, and SIFT, respectively. The corresponding costs of ① and ③ are reported in Table 2.
Exp. 3-2: Online Search Strategy. Fig. 13 compares LinePG with ① pair edge first, which explores edges in before edges in ; ② normal pair edge, which treats pair edges as ordinary adjacency entries; ③ pair edge last, which explores edges in before edges in ; and ④ no leaf gate, which removes the test while retaining point-level visited checks. These variants examine how pair edges are scheduled and whether repeated entrances into an already explored leaf should be suppressed.
Compared with ① pair edge first and ③ pair edge last, LinePG always has better search performance, which supports selective interleaving of local exploration and inter-region probes. The comparison with ② normal pair edge nevertheless reveals a tradeoff, rather than uniform dominance. On SIFT, LinePG achieves 2.23x its QPS at a recall target of 0.995. At a target of 0.999, however, ② attains recall 0.9995 at 128.16 QPS, compared with recall 0.9993 at 61.31 QPS for LinePG, making ② 2.09x faster. Thus, selective pair-edge use improves efficiency at several measured operating points but unrestricted exploration remains competitive in the high-recall
LinePG No hierarchy No quotient graph No graph smoothing

(a) YaleB
(b) Multi-PIE
(c) SIFT
Figure 14: Ablation study for pair edge selection (Exp. 3)

(a)
(b) b

(c)

(d)
(e)

(f) r
Figure 15: Parameter sensitivity study on YaleB (Exp. 4)
tail. Compared with ④ no leaf gate, the check to avoid repeat region exploration leads to a higher QPS at similar recall.
Exp. 3-3: Offline Pair Edge Selection. Fig. 14 compares LinePG with ① no hierarchy, which removes hierarchy-derived region pairs; ② no quotient graph, which removes quotient-derived region pairs; and ③ no smoothing, which retains a geometry-only hierarchy.
At the 0.99 recall target, LinePG achieves 1.09–2.43x the QPS of these variants across the three datasets. These results support combining hierarchy-derived spatial candidates with candidates lacking short quotient paths, and using graph smoothing to incorporate local connectivity into the partition. Index sizes remain nearly unchanged under the same degree budgets. For ①, ②, and ③, respectively, construction takes 3.176, 4.480, and 4.281 s on YaleB; 47.928, 69.075, and 63.310 s on Multi-PIE; and 509.614, 598.292, and 565.587 s on SIFT. Removing hierarchy candidates yields the largest construction-time reduction, while omitting quotient candidates or smoothing provides smaller savings relative to the full method.
Exp. 4: Parameter Sensitivity. Fig. 15 examines , , , , , and on YaleB with . We vary one parameter at a time while keeping the other parameters at their default values. (1) Pair-edge degree : We vary over while keeping the total degree limit fixed. As shown in Fig. 15(a), at a recall target of 0.99, provides 4.23x, 1.98x, and 1.10x QPS of , respectively. This supports allocating a moderate number of edges to inter-region navigation. Too few pair edges limit the available entrances, whereas a larger budget can displace useful original connections under the fixed total degree limit. (2) Leaf capacity : We vary over , and their reported construction times are 5.09, 4.97, 4.96, 4.91, and 4.82 s, respectively. As shown in Fig. 15(b), smaller leaves create more regions to process, but lead to larger index time. The effect on query performance is more substantial. At the 0.99 recall target, achieves 1,394.57 QPS, compared

(a) QPS
(b) Index size

(c) Index time
Figure 16: Scalability evaluation (Exp. 5)
with 977.77 QPS for and 73.00 QPS for . Thus, leaf capacity affects the resolution of region selection and its recall–QPS tradeoff. (3) Smoothing rounds : We test . As shown in Fig. 15(c), at recall 1.0, four rounds are 1.79x as fast as no smoothing and 13.41x as fast as eight rounds at this operating point. These results support a finite smoothing budget: graph averaging can improve the partition, whereas excessive averaging can weaken the initial geometric distinctions. (4) Sampling budget : We vary . Fig. 15(d) shows that increasing may lead to better search performance while it also increases the index building time. The construction times increase from 4.02 to 4.47, 4.96, 5.24, and 5.50 s. The default balances this construction cost with strong high-recall performance; larger budgets can help at other operating points but do not consistently dominate it. (5) Quotient-hop radius : We vary over . As shown in Fig. 15(e), at the 0.99 recall, the default is 1.16x, 1.44x, 1.14x, and 1.50x as fast as the other settings at this target. A small hop radius admits destinations still connected through short multi-hop routes, whereas a larger radius excludes more destinations and can restrict the available quotient candidates. The results support an intermediate exclusion radius. (6) Retained region partners : We vary over . As shown in Fig. 15(f), at the 0.99 recall target, increasing from 4 to 8 and 16 raises QPS from 752.47 to 846.47 and 977.77. Further increasing it to 32 and 64 yields 1,052.76 and 1,018.01 QPS. Increasing first leads to higher QPS, while the clearest saturation occurs between and 64, QPS decreases by 3.30% relative to . The total number of selected region pairs increases only 0.28%, although the partner cap doubles, indicating limited additional selections without further QPS improvement.
Exp. 5: Scalability. We evaluate the scalability of LinePG on SIFT100M [1] by scaling the dataset size from 10M to 100M points. Fig. 16(a) reports QPS achieved at fixed target recalls. As the scale increases, query throughput consistently decreases for all settings, while the method still delivers 394.3 QPS at Recall@10 = 0.95 and 140.8 QPS at Recall@100 = 0.95 on the 100M dataset. The index size (excluding base vectors) curves in Fig. 16(b) exhibit nearly linear growth with data scale for both the underlying HNSW graph and our enhancements. Fig. 16(c) shows that both HNSW build time and the enhancement time increase with scale, and together lead to a total build time of 7.49k s at 10M and 144.90k s at 100M. The enhancement stage is comparable to HNSW construction cost across the full range, which confirms that the overall index construction remains practical even at the largest scale tested.
9 Conclusion
In this paper, we study the approximate line nearest neighbor search in vector databases. We propose LinePG, which enhances a proximity graph with selected pair edges while retaining the original vector dimension and total degree limit. Our extensive experiments demonstrate that LinePG outperforms all existing methods for LANN search. At Recall@10 of 0.99, LinePG delivers up to 4.23x QPS of DirectSearch, and a higher recall that DirectSearch cannot reach. Compared with Lift, it achieves better search performance while using only 1.86% of the index space and 2.15% of the construction time on full datasets on average. LinePG achieves index construction that is more than 3 orders of magnitude faster, with a much smaller index size and higher search performance than TheoryLP.
References
[1] 2010. Datasets for approximate nearest neighbor search. http://corpus-texmex.irisa.fr/.
[2] Alexandr Andoni, Piotr Indyk, Robert Krauthgamer, and Huy L. Nguyen. 2009. Approximate line nearest neighbor in high dimensions. In SODA. SIAM, 293–301.
[3] Ilias Azizi, Karima Echihabi, and Themis Palpanas. 2025. Graph-Based Vector Search: An Experimental Evaluation of the State-of-the-Art. Proc. ACM Manag. Data 3, 1 (2025), 43:1–43:31.
[4] Manuel Blum, Robert W. Floyd, Vaughan R. Pratt, Ronald L. Rivest, and Robert Endre Tarjan. 1973. Time Bounds for Selection. J. Comput. Syst. Sci. 7, 4 (1973), 448–461.
[5] Stephen Boyd and Lieven Vandenberghe. 2004. Convex Optimization. Cambridge University Press.
[6] Cong Fu, Chao Xiang, Changxu Wang, and Deng Cai. 2019. Fast Approximate Nearest Neighbor Search With The Navigating Spreading-out Graph. Proc. VLDB Endow. 12, 5 (2019), 461–474.
[7] Athinodoros S. Georghiades, Peter N. Belhumeur, and David J. Kriegman. 2001. From Few to Many: Illumination Cone Models for Face Recognition under Variable Lighting and Pose. IEEE Trans. Pattern Anal. Mach. Intell. 23, 6 (2001), 643–660.
[8] Ralph Gross, Iain A. Matthews, Jeffrey F. Cohn, Takeo Kanade, and Simon Baker. 2010. Multi-PIE. Image Vis. Comput. 28, 5 (2010), 807–813.
[9] Qiang Huang, Yifan Lei, and Anthony K. H. Tung. 2021. Point-to-Hyperplane Nearest Neighbor Search Beyond the Unit Hypersphere. In SIGMOD. ACM, 777–789.
[10] Piotr Indyk and Rajeev Motwani. 1998. Approximate Nearest Neighbors: Towards Removing the Curse of Dimensionality. In Proceedings of the Thirtieth Annual ACM Symposium on the Theory of Computing. ACM, 604–613.
[11] Suhas Jayaram Subramanya, Fnu Devvrit, Harsha Vardhan Simhadri, Ravishankar Krishnawamy, and Rohan Kadekodi. 2019. DiskANN: Fast Accurate Billion-point Nearest Neighbor Search on a Single Node. In Advances in Neural Information Processing Systems, Vol. 32. Curran Associates, Inc.
[12] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. 2018. Progressive Growing of GANs for Improved Quality, Stability, and Variation. In ICLR. OpenReview.net.
[13] Tero Karras, Samuli Laine, and Timo Aila. 2019. A Style-Based Generator Architecture for Generative Adversarial Networks. In CVPR. Computer Vision Foundation / IEEE, 4401–4410.
[14] Ira Kemelmacher-Shlizerman, Eli Shechtman, Rahul Garg, and Steven M. Seitz. 2011. Exploring photobios. ACM Trans. Graph. 30, 4 (2011), 61.
[15] Daniel Keysers, Jörg Dahmen, Thomas Theiner, and Hermann Ney. 2000. Experiments with an Extended Tangent Distance. In ICPR'00. IEEE Computer Society, 2038–2042.
[16] Kuang-Chih Lee, Jeffrey Ho, and David J. Kriegman. 2005. Acquiring Linear Subspaces for Face Recognition under Variable Lighting. IEEE Trans. Pattern Anal. Mach. Intell. 27, 5 (2005), 684–698.
[17] Binhong Li, Xiao Yan, and Shangqi Lu. 2026. Fast-Convergent Proximity Graphs for Approximate Nearest Neighbor Search. Proc. ACM Manag. Data 4, 1 (2026), 36:1–36:24.
[18] Wen Li, Ying Zhang, Yifang Sun, Wei Wang, Mingjie Li, Wenjie Zhang, and Xuemin Lin. 2020. Approximate Nearest Neighbor Search on High Dimensional Data - Experiments, Analyses, and Improvement. IEEE Trans. Knowl. Data Eng. 32, 8 (2020), 1475–1488.
[19] Shangqi Lu and Yufei Tao. 2025. Proximity Graphs for Similarity Search: Fast Construction, Lower Bounds, and Euclidean Separation. Proc. ACM Manag. Data 3, 5 (2025), 280:1–280:25.
[20] Avner Magen. 2007. Dimensionality Reductions in that Preserve Volumes and Distance to Affine Spaces. Discret. Comput. Geom. 38, 1 (2007), 139–153.
[21] Yury Malkov, Alexander Ponomarenko, Andrey Logvinov, and Vladimir Krylov. 2014. Approximate nearest neighbor algorithm based on navigable small world graphs. Inf. Syst. 45 (2014), 61–68.
[22] Yury A. Malkov and Dmitry A. Yashunin. 2020. Efficient and Robust Approximate Nearest Neighbor Search Using Hierarchical Navigable Small World Graphs. IEEE Trans. Pattern Anal. Mach. Intell. 42, 4 (2020), 824–836.
[23] Magdalen Dobson Manohar, Zheqi Shen, Guy E. Blelloch, Laxman Dhulipala, Yan Gu, Harsha Vardhan Simhadri, and Yihan Sun. 2024. ParlayANN: Scalable and Deterministic Parallel Graph-Based Approximate Nearest Neighbor Search Algorithms. In Proceedings of the 29th ACM SIGPLAN Annual Symposium on Principles and Practice of Parallel Programming, PPoPP 2024, Edinburgh, United Kingdom, March 2-6, 2024. ACM, 270–285.
[24] Ricardo Martin-Brualla, David Gallup, and Steven M. Seitz. 2015. Time-lapse mining from internet photos. ACM Trans. Graph. 34, 4 (2015), 62:1–62:8.
[25] Stanley Milgram. 1967. The small world problem. Psychology today 2, 1 (1967), 60–67.
[26] Wolfgang Mulzer, Huy L. Nguyen, Paul Seiferth, and Yannik Stein. 2015. Approximate k-flat Nearest Neighbor Search. In STOC. ACM, 783–792.
[27] Yun Peng, Byron Choi, Tsz Nam Chan, Jianye Yang, and Jianliang Xu. 2023. Efficient Approximate Nearest Neighbor Search in Multi-dimensional Databases. Proc. ACM Manag. Data 1, 1 (2023), 54:1–54:27.
[28] Runway. 2025. Creating with Gen-4 Image References. https://help.runwayml.com/hc/en-us/articles/40042718905875-Creating-with-Gen-4-Image-References.
[29] Yujun Shen, Jinjin Gu, Xiaoou Tang, and Bolei Zhou. 2020. Interpreting the Latent Space of GANs for Semantic Face Editing. In CVPR. Computer Vision Foundation / IEEE, 9240–9249.
[30] Patrice Y. Simard, Yann LeCun, and John S. Denker. 1992. Efficient Pattern Recognition Using a New Transformation Distance. In NIPS Conference. Morgan Kaufmann, 50–58.
[31] Manuel Then, Moritz Kaufmann, Fernando Chirigati, Tuan-Anh Hoang-Vu, Kien Pham, Alfons Kemper, Thomas Neumann, and Huy T. Vo. 2014. The More the Merrier: Efficient Multi-Source Graph Traversal. Proc. VLDB Endow. 8, 4 (2014), 449–460.
[32] Omer Tov, Yuval Alaluf, Yotam Nitzan, Or Patashnik, and Daniel Cohen-Or. 2021. Designing an encoder for StyleGAN image manipulation. ACM Trans. Graph. 40, 4 (2021), 133:1–133:14.
[33] Matthew Turk and Alex Pentland. 1991. Eigenfaces for recognition. J. Cognitive Neuroscience 3, 1 (Jan. 1991), 71–86.
[34] Jianguo Wang, Xiaomeng Yi, Rentong Guo, Hai Jin, Peng Xu, Shengjun Li, Xiangyu Wang, Xiangzhou Guo, Chengming Li, Xiaohai Xu, Kun Yu, Yuxing Yuan, Yinghao Zou, Jiquan Long, Yudong Cai, Zhenxiang Li, Zhifeng Zhang, Yihua Mo, Jun Gu, Ruiyi Jiang, Yi Wei, and Charles Xie. 2021. Milvus: A Purpose-Built Vector Data Management System. In SIGMOD '21. ACM, 2614–2627.
[35] Mengzhao Wang, Xiaoliang Xu, Qiang Yue, and Yuxiang Wang. 2021. A Comprehensive Survey and Experimental Comparison of Graph-Based Approximate Nearest Neighbor Search. Proc. VLDB Endow. 14, 11 (2021), 1964–1978.
[36] Zeyu Wang, Qitong Wang, Xiaoxing Cheng, Peng Wang, Themis Palpanas, and Wei Wang. 2024. Steiner-Hardness: A Query Hardness Measure for Graph-Based ANN Indexes. Proc. VLDB Endow. 17, 13 (2024), 4668–4682.
[37] Jiadong Xie, Yingfan Liu, and Jeffrey Xu Yu. 2026. Advances of Query Processing in Vector Databases. Proceedings of the VLDB Endowment 19, 12 (2026), 4893–4899.
[38] Jiadong Xie, Jeffrey Xu Yu, and Yingfan Liu. 2025. Graph Based K-Nearest Neighbor Search Revisited. ACM Trans. Database Syst. 50, 4 (2025), 14:1–14:30.
[39] Shuo Yang, Jiadong Xie, Yingfan Liu, Jeffrey Xu Yu, Xiyue Gao, Qianru Wang, Yanguo Peng, and Jiangtao Cui. 2025. Revisiting the Index Construction of Proximity Graph-Based Approximate Nearest Neighbor Search. PVLDB 18, 6 (2025), 1825–1838.
[40] Ziqi Yin, Jianyang Gao, Pasquale Balsebre, Gao Cong, and Cheng Long. 2025. DEG: Efficient Hybrid Vector Search Using the Dynamic Edge Navigation Graph. Proc. ACM Manag. Data 3, 1 (2025), 29:1–29:28.
[41] Qianxi Zhang, Shuotao Xu, Qi Chen, Guoxin Sui, Jiadong Xie, Zhizhen Cai, Yaoqi Chen, Yinxuan He, Yuqing Yang, Fan Yang, Mao Yang, and Lidong Zhou. 2023. VBASE: Unifying Online Vector Similarity Search and Relational Queries via Relaxed Monotonicity. In 17th USENIX Symposium on Operating Systems Design and Implementation, OSDI 2023. USENIX Association, 377–395.
[42] Xi Zhao, Zhoujin Tian, Kai Huang, Yao Tian, Xiaokui Xiao, Bolong Zheng, and Xiaofang Zhou. 2026. Enhancing Graph-based Approximate Maximum Inner Product Search via Norm-Adaptive Partitioning. Proc. ACM Manag. Data 4, 3 (2026), 174:1–174:26.