SURF: Substring Filtered Approximate Nearest Neighbor Search
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
arXiv:2611.36963v1 [cs.DB] 27 Nov 2026
SURF: Substring Filtered Approximate Nearest Neighbor Search Jiadong Xie
Hao Jiang
Yingfan Liu
The Chinese University of Hong Kong jdxie@se.cuhk.edu.hk
Xidian University haojiang0310@stu.xidian.edu.cn
Xidian University liuyingfan@xidian.edu.cn
Jeffrey Xu Yu
Hui Li
Jiangtao Cui
The Hong Kong University of Science and Technology (Guangzhou) jeffreyxuyu@hkust-gz.edu.cn
Xidian University hli@xidian.edu.cn
Xi’an University of Posts and Telecommunications Xidian University cuijt@xupt.edu.cn
Abstract Given a collection of objects O with high-dimensional vectors and associated strings, such as product images and their textual descriptions, filtered approximate nearest neighbor (ANN) search retrieves vectors similar to a query vector 𝑞 while satisfying a user-specified predicate. We study substring filtered ANN search, where eligible objects are those whose string attributes contain a query string as a substring. Existing methods are sensitive to query selectivity: they either enumerate large qualifying sets or traverse many nonqualifying objects, incurring redundant distance computations. Although VectorMaton introduces a dedicated index for this problem, its fine-grained automaton states and heuristic index reuse strategy without global optimality guarantees lead to substantial indexing overhead. We propose SURF, an index featuring a provably minimal suffix automaton that confines graph traversal to objects satisfying the substring predicate. To further reduce its index cost, we develop ComSURF, which introduces path and ancestor compression and optimally combines them through a dynamic programming algorithm. We also extend our approach to support SQL LIKE predicate queries with two wildcards. We conduct extensive performance studies and confirm the accuracy and efficiency of our approach in comparison with the state-of-the-art approaches.
1
Introduction
Recent advancements in embedding models utilizing machine learning techniques have revolutionized the representation of various types of data, including images [25], texts [24], and audio [6], by transforming them into high-dimensional vectors that capture their semantic information. This has led to a surge in the need for managing high-dimensional data [4, 12, 21, 26, 48]. When considering a set of objects O consisting of 𝑛 objects, each object can be denoted as a 𝑑-dimensional vector in R𝑑 . A fundamental task is to identify similar objects in O to a given object represented as a vector 𝑣𝑞 ∈ R𝑑 . This task is formalized as approximate nearest neighbor (ANN) search in high-dimensional data management, which aims to find 𝑘 vectors in O that are sufficiently close to a given query vector 𝑣𝑞 . In many real-world applications, however, objects are associated not only with vectors but also with string attributes. For example, product images are accompanied by textual descriptions, scientific papers contain titles, authors, and publication venues, and audio files include creator and album metadata. Users therefore often combine vector similarity with string predicates to restrict the search to eligible objects. For instance, Google Multisearch combines string
conditions with similarity search over image embeddings [5]. Moreover, the combination of semantic similarity and exact string matching appears in a wide range of applications. In agentic, log, and code search, vector retrieval identifies semantically related objects, whereas lexical or grep-style matching remains effective for exact identifiers, paths, and error messages [16, 20, 31]. Similarly, recent DNA foundation models provide vector embeddings for genomic sequences [11], while exact string matching remains a fundamental operation for locating sequence fragments [29]. Among string constraints, substring filtering is one of the most fundamental and commonly used operations [46]. Therefore, in this paper, we study the problem of substring filtered ANN search. Formally, given a query 𝑞 = (𝑣𝑞 , 𝑠𝑞 ), substring filtered ANN search aims to find the approximate nearest neighbors of 𝑣𝑞 among the objects in O whose text attributes contain 𝑠𝑞 as a substring. However, efficiently supporting substring filtered ANN search remains challenging. Pre-filtering [34, 37] enumerates the qualifying objects before vector search, which becomes expensive when the predicate selectivity is high. In contrast, post-filtering [34, 37, 45] and general predicate-aware ANN methods [27, 48] may traverse many non-qualifying objects, particularly at low or moderate selectivities. Similarly, dense-sparse hybrid search [10] combines lexical and semantic similarities but cannot guarantee that all visited objects satisfy the exact substring predicate. Consequently, these approaches either incur substantial costs in enumerating qualifying objects or waste expensive distance computations on non-qualifying objects, resulting in unstable query performance across different selectivity regimes. The most closely related work is VectorMaton [38], which introduces an enhanced suffix automaton to organize substring-related vector sets and employs index reuse to reduce indexing costs. However, it has two issues. First, VectorMaton groups substrings according to their occurrence-position lists, which are more fine-grained than necessary for substring filtered ANN search. Since our problem only requires the set of objects containing a query substring, different occurrence-position lists may correspond to identical object sets and equivalent future query behavior. Treating them as separate states introduces redundant automaton states and index construction. Second, its index reuse strategy relies on greedy, state-wise decisions without global optimality guarantees, and it does not fully leverage proximity-graph properties; instead, it constructs two separate indices for a reused state. Such local decisions result in unnecessary index construction and additional search and result-merging overhead.
Jiadong Xie, Hao Jiang, Yingfan Liu, Jeffrey Xu Yu, Hui Li, and Jiangtao Cui
To address these issues, we propose a new index structure for substring filtered ANN search, featuring a provably minimal automaton and a globally optimal compression strategy. The main contributions of this work are summarized as follows. ➊ We propose SURF, a dedicated index for substring-filtered ANN queries, with a key component MultiSA, a minimized suffix automaton that groups substrings according to their qualifying object sets under all possible continuations. We prove that MultiSA is the minimal deterministic state-output automaton for our problem, thereby eliminating redundant states in the enhanced suffix automaton of VectorMaton. ➋ To reduce the index cost, we develop ComSURF, a compressed variant of SURF that better exploits the structural properties of proximity graphs. Specifically, we introduce two complementary compression rules, formulate their joint optimization as an exact dynamic programming problem, and develop an efficient algorithm to obtain the globally optimal compression plan. ➌ To efficiently process queries over ComSURF, we develop a search algorithm that adaptively combines multiple search strategies. We further extend our approach to support SQL LIKE predicates containing both single-character (_) and multi-character (%) wildcards. ➍ We conduct extensive experiments on 8 real-world datasets. The results demonstrate that ComSURF consistently outperforms state-of-theart baselines across different query selectivities. Compared with VectorMaton, ComSURF achieves up to 1.99× higher QPS at comparable recall, while reducing index time by 2.28–5.70× and index size by 1.78–3.42×. Moreover, it achieves up to two to three orders of magnitude higher QPS than baselines on LIKE predicates. The paper is organized as follows. We present the preliminaries in Section 2 and discuss the limitations of existing methods in Section 3. We then provide an overview of our index design in Section 4, present the optimal compression strategy in Section 5, describe the index construction details in Section 6, and introduce our search algorithms in Section 7. Finally, we conduct extensive experiments to demonstrate the effectiveness and efficiency of our approach in Section 8, and conclude the paper in Section 9.
2
Preliminaries
We first formulate the problem studied in this paper. Let O = {𝑜 1, 𝑜 2, · · · , 𝑜𝑛 } = {(𝑣 1, 𝑠 1 ), (𝑣 2, 𝑠 2 ), · · · , (𝑣𝑛 , 𝑠𝑛 )} be a dataset consisting of 𝑛 objects, where each object 𝑜𝑖 consists of a 𝑑-dimensional vector 𝑣𝑖 ∈ R𝑑 , and a string attribute 𝑠𝑖 . The distance between two vectors, 𝑣𝑖 and 𝑣 𝑗 , denoted as 𝛿 (𝑣𝑖 , 𝑣 𝑗 ), is Euclidean distance in the 𝐿2 norm. Let Σ be an alphabet, each object’s attribute 𝑠𝑖 comprises characters from Σ, i.e., 𝑠𝑖 ∈ Σ∗ . For a string 𝑇 = 𝑡 1 . . . 𝑡 |𝑇 | , we denote a substring 𝑡𝑙 . . . 𝑡𝑟 of 𝑇 as 𝑇 [𝑙, 𝑟 ]. Substring Filtered 𝑘-ANN Query: For a query string 𝑠𝑞 over Σ (𝑠𝑞 ∈ Σ∗ ), let O𝑠𝑞 ⊆ O be the set of objects for which 𝑠𝑞 is a substring of their attributes, i.e., O𝑠𝑞 = {𝑜𝑖 = (𝑣𝑖 , 𝑠𝑖 ) ∈ O | 𝑠𝑞 is a substring of 𝑠𝑖 }. The substring filtered 𝑘-approximate nearest neighbor (SFANN) query 𝑞 = (𝑣𝑞 , 𝑠𝑞 ) is to find the 𝑘-approximate nearest neighbors (𝑘-ANN) in O𝑠𝑞 for user-given query vector 𝑣𝑞 . Let 𝑆𝑒𝑙 (𝑠𝑞 ) be the fraction of objects that satisfy the substring filter, i.e., 𝑆𝑒𝑙 (𝑠𝑞 ) = |O𝑠𝑞 |/|O|. We use 𝑟𝑒𝑐𝑎𝑙𝑙@𝑘 to measure the quality of a 𝑘-ANN query 𝑞, which is defined as |U ∩ R|/𝑘, where U is the ground-truth object set which satisfies the substring filter 𝑠𝑞 , and R is the set found by an SFANN method for query 𝑞.
We then review the preliminary knowledge of the proximity graphs designed for 𝑘-ANN queries. Proximity Graphs: For a 𝑘-ANN query 𝑞 = (𝑣𝑞 , ∅), i.e., which aims to find the 𝑘-ANN from O, the state-of-the-art approaches, e.g., NSG [14] and HNSW [22], can support it using a proximity graphs built. Here, a proximity graph 𝐺 = (𝑉 , 𝐸), where 𝑣𝑖 ∈ 𝑉 represents a unique vector 𝑣𝑖 (e.g., 𝑣𝑖 in 𝑜𝑖 = (𝑣𝑖 , 𝑠𝑖 ) ∈ O), and an edge (𝑣𝑖 , 𝑣 𝑗 ) ∈ 𝐸 represents that 𝑣 𝑗 is regarded as a close neighbor of 𝑣𝑖 under the distance function 𝛿 (𝑣𝑖 , 𝑣 𝑗 ), e.g., 𝑣 𝑗 may be one of the 𝑘-nearest neighbors of 𝑣𝑖 . Over a PG graph, 𝐺, constructed, a widely used greedy procedure is beam search [14, 17, 18, 22, 26, 28, 36, 40]. At a high level, beam search maintains a bounded priority queue of promising nodes ordered by their distances to 𝑣𝑞 . It repeatedly expands the nearest unvisited node, inserts its unseen graph neighbors into the queue, and removes the farthest candidates whenever the queue exceeds the beam width 𝑤. The process terminates when no retained candidate remains to be expanded, after which the 𝑘 closest nodes are returned. Each visited node requires a distance computation against 𝑣𝑞 , and these computations dominate graphsearch latency in practice. Thus, the number of traversed nodes is a central cost measure in our discussion of filtered ANN search. We next introduce the suffix automaton for representations of a single string as follows. Suffix Automaton: Suffix automaton (SA) [7, 8] is a partial deterministic finite automaton that recognizes all suffixes of a given string. An SA can be viewed as a directed acyclic graph (DAG) G = (V, E). Here, V = {𝑞[0], 𝑞[1], . . . , 𝑞[|V | − 1]} represents a finite set of states, 𝑞[0] (also denoted by 𝑞 0 ) is the unique source node in G, 𝐹 ⊆ V is the set of accepting states, and E encapsulates the transitions in V × Σ → V, where Σ is an alphabet. Specifically, an edge from 𝑞[𝑖] to 𝑞[ 𝑗] with label 𝑐 ∈ Σ is denoted by 𝑞[𝑖].Δ[𝑐] = 𝑞[ 𝑗]. SA is the smallest DAG that satisfies: (i) every node in V is reachable from 𝑞[0]; (ii) outgoing edges of the same node have distinct character labels; (iii) the concatenation of labels along any path from 𝑞[0] to an accepting state 𝑣 ∈ 𝐹 forms a suffix of the string; and (iv) every suffix of the string can be represented by such a path. For example, Fig. 1 shows the SA of string abbb, where 𝐹 = {𝑞 4, 𝑞 5, 𝑞 6 }. The label sequence on the paths from 𝑞 0 to 𝑞 4 and 𝑞 6 , and the two paths from 𝑞 0 to 𝑞 5 , represent all suffixes. For a string 𝑇 , its suffix automaton (SA) G = (V, E) contains at most 2|𝑇 | − 1 states and 3|𝑇 | − 4 transitions, and can be constructed in 𝑂 (|𝑇 |) time [8]. During construction, each state 𝑝 ∈ V maintains its maximum represented string length 𝑝.𝑙𝑒𝑛 and a suffix link 𝑝.𝑙𝑖𝑛𝑘. The latter points to the state representing the longest proper-suffix class of the strings represented by 𝑝; the initial state 𝑞[0] has 𝑞[0].𝑙𝑖𝑛𝑘 = ∅. The black statements in Algorithm 1 outline single-string SA construction, i.e., here 𝑛 = 1, i.e., T = {𝑇 }. Let 𝑙𝑎𝑠𝑡 be the state corresponding to the current prefix before inserting 𝑡𝑖 ; initially, 𝑙𝑎𝑠𝑡 = 𝑞[0] (line 3). For each character 𝑡𝑖 (line 4), we first create a new node 𝑐𝑢𝑟 with 𝑐𝑢𝑟 .𝑙𝑒𝑛 = 𝑙𝑎𝑠𝑡 .𝑙𝑒𝑛 + 1 (line 5), and then trace suffix links from 𝑙𝑎𝑠𝑡 (line 6). As long as the current node has no transition labeled 𝑡𝑖 , we add a transition to 𝑐𝑢𝑟 and continue following suffix links (lines 7-8). If no such node 𝑝 exists, we set 𝑐𝑢𝑟 .𝑙𝑖𝑛𝑘 ← 𝑞[0] and finish this iteration (line 18). Otherwise, let 𝑝 ′ = 𝑝.Δ[𝑡𝑖 ] (line 20). If 𝑝.𝑙𝑒𝑛 + 1 = 𝑝 ′ .𝑙𝑒𝑛, we set 𝑐𝑢𝑟 .𝑙𝑖𝑛𝑘 ← 𝑝 ′ (line 21). If not, we clone 𝑝 ′ into a new node 𝑝 ′′ , copy all information from 𝑝 ′ except setting 𝑝 ′′ .𝑙𝑒𝑛 ← 𝑝.𝑙𝑒𝑛 + 1 (line 23), and then
SURF: Substring Filtered Approximate Nearest Neighbor Search
Algorithm 1: BuildSA/BuildMultiSA (T ) Input : T = {𝑇1 , . . . ,𝑇𝑛 } and corresponding vectors {𝑣1 , . . . , 𝑣𝑛 } Output : an SA / MultiSA G 1 Create 𝑞 [0] with 𝑞 [0].𝑙𝑒𝑛 ← 0; 𝑞 [0].𝑙𝑖𝑛𝑘 ← ∅; 𝑞 [0]. O ← ∅; 2 for each 𝑇 𝑗 ∈ T do 3 𝑙𝑎𝑠𝑡 ← 𝑞 [0]; 4 for each character 𝑡𝑖 of 𝑇 𝑗 in order do 5 Create a state 𝑐𝑢𝑟 with 𝑐𝑢𝑟 .𝑙𝑒𝑛 ← 𝑙𝑎𝑠𝑡 .𝑙𝑒𝑛 + 1; 6 𝑝 ← 𝑙𝑎𝑠𝑡 ; 7 while 𝑝 ≠ ∅ and 𝑝.Δ[𝑡𝑖 ] = ∅ do 8 𝑝.Δ[𝑡𝑖 ] ← 𝑐𝑢𝑟 ; 𝑝 ← 𝑝.𝑙𝑖𝑛𝑘; 9 10 11 12 13 14 15 16
𝑙𝑎𝑠𝑡 . O ← 𝑙𝑎𝑠𝑡 . O ∪ {𝑣 𝑗 }; if 𝑝 = 𝑙𝑎𝑠𝑡 then 𝑝 ′ ← 𝑙𝑎𝑠𝑡 .Δ[𝑡𝑖 ]; if 𝑙𝑎𝑠𝑡 .𝑙𝑒𝑛 + 1 = 𝑝 ′ .𝑙𝑒𝑛 then Remove 𝑐𝑢𝑟 ; 𝑙𝑎𝑠𝑡 ← 𝑝 ′ ; continue; Create a clone 𝑝 ′′ of 𝑝 ′ with 𝑝 ′′ .𝑙𝑒𝑛 ← 𝑙𝑎𝑠𝑡 .𝑙𝑒𝑛 + 1; 𝑝 ′ .𝑙𝑖𝑛𝑘 ← 𝑝 ′′ ; while 𝑝 ≠ ∅ and 𝑝.Δ[𝑡𝑖 ] = 𝑝 ′ do 𝑝.Δ[𝑡𝑖 ] ← 𝑝 ′′ ; 𝑝 ← 𝑝.𝑙𝑖𝑛𝑘; 𝑙𝑎𝑠𝑡 ← 𝑝 ′′ ; Remove 𝑐𝑢𝑟 ; continue;
17 18 19 20 21 22 23 24 25 26
if 𝑝 = ∅ then 𝑐𝑢𝑟 .𝑙𝑖𝑛𝑘 ← 0; 𝑙𝑎𝑠𝑡 ← 𝑐𝑢𝑟 ; continue; 𝑝 ′ ← 𝑝.Δ[𝑡𝑖 ]; 𝑙𝑎𝑠𝑡 ← 𝑐𝑢𝑟 ; if 𝑝.𝑙𝑒𝑛 + 1 = 𝑝 ′ .𝑙𝑒𝑛 then 𝑐𝑢𝑟 .𝑙𝑖𝑛𝑘 ← 𝑝 ′ ; else Create a clone 𝑝 ′′ of 𝑝 ′ with 𝑝 ′′ .𝑙𝑒𝑛 ← 𝑝.𝑙𝑒𝑛 + 1; 𝑐𝑢𝑟 .𝑙𝑖𝑛𝑘 ← 𝑝 ′′ ; 𝑝 ′ .𝑙𝑖𝑛𝑘 ← 𝑝 ′′ ; while 𝑝 ≠ ∅ and 𝑝.Δ[𝑡𝑖 ] = 𝑝 ′ do 𝑝.Δ[𝑡𝑖 ] ← 𝑝 ′′ ; 𝑝 ← 𝑝.𝑙𝑖𝑛𝑘; 𝑙𝑎𝑠𝑡 . O ← 𝑙𝑎𝑠𝑡 . O ∪ {𝑣 𝑗 };
G ← the set of all created, non-removed states; 28 for each state 𝑝 ∈ G in descending order of 𝑝.𝑙𝑒𝑛 do 29 if 𝑝.𝑙𝑖𝑛𝑘 ≠ ∅ then 𝑝.𝑙𝑖𝑛𝑘. O ← 𝑝.𝑙𝑖𝑛𝑘. O ∪ 𝑝. O; 27
30
return G;
set both 𝑐𝑢𝑟 .𝑙𝑖𝑛𝑘 and 𝑝 ′ .𝑙𝑖𝑛𝑘 to 𝑝 ′′ (line 24). Finally, we continue tracing suffix links from 𝑝 and redirect every transition labeled 𝑡𝑖 that points to 𝑝 ′ to point to 𝑝 ′′ instead (lines 25-26). For example, the constructed SA of string abbb is shown in Fig. 1, where the represented substring set of each state is illustrated, e.g., 𝑞 5 represents abbb and bbb, corresponding to the two paths from 𝑞 0 to 𝑞 5 .
3
Limitations of Existing Approaches
In this section, we first discuss VectorMaton [38], the most closely related and state-of-the-art index for substring filtered ANN search, and then summarize why other filtered ANN approaches do not fully address our setting. VectorMaton [38]: VectorMaton extends SA, which represents all substrings of a single string, to a collection of strings. Specifically, it constructs an enhanced suffix automaton (ESA), where each state represents a set of equivalent substrings having identical occurrence-position lists, with each occurrence recorded as a pair of sequence ID and ending position. This extension allows VectorMaton to distinguish substrings that occur in the same set
of sequences but at different positions, thereby maintaining the exact occurrence information across multiple strings. Similarly, the resulting ESA forms a directed acyclic graph (DAG) through character transitions. To support substring filtered 𝑘-ANN queries, VectorMaton considers constructing an index containing the corresponding vectors of each state in ESA. For index reuse, it exploits the descendant relationships in this transition DAG. Specifically, let O𝑥 be the set of objects contained in state 𝑥 in ESA, for each state 𝑥, it selects the descendant 𝑦 with the largest indexed vector set as its inherited index, i.e., O𝑦 ⊆ O𝑥 , and constructs a local index only over the remaining vectors, i.e., vectors in O𝑥 \ O𝑦 . It further adopts a threshold-based skip-build strategy, which stores small residual vector sets directly rather than constructing HNSW graphs. VectorMaton has several issues, as illustrated below. ➀ Automaton Issue: VectorMaton groups substrings according to their complete occurrence-position lists. In our problem, however, the needed information is only the set of vector IDs whose strings contain the query string 𝑠𝑞 ; occurrence positions and multiplicities are not considered. Two states can therefore be equivalent for all possible future query outputs even when their occurrence-position lists differ. For example, consider three objects 𝑜 1 = (𝑣 1, aa), 𝑜 2 = (𝑣 2, ab), and 𝑜 3 = (𝑣 3, abbb), the corresponding ESA is shown in Fig. 2. Considering the substrings ab (state 𝑞 3 ) and b (state 𝑞 4 ), they have different occurrence-position lists, i.e., {(2, 2), (3, 2)} and {(2, 2), (3, 2), (3, 3), (3, 4)}, respectively, and are therefore kept as two ESA states. However, as O𝑞3 = O𝑞4 , for every continuation 𝑥, they induce the same vector set, i.e., Oab𝑥 = Ob𝑥 always holds. The same holds for abb (state 𝑞 5 ) and bb (state 𝑞 6 ). Hence, as shown in Fig. 3, the eight-state ESA in this example can be quotiented into six states by merging {𝑞 3, 𝑞 4 } and {𝑞 5, 𝑞 6 }, without changing the answer to any substring-filtered query. Therefore, an automaton built from position-list equivalence is correct, but its states are not minimized. Thus, the equivalent states in ESA add index cost, as VectorMaton considers building an index for each state. ➁ Index Reuse Issue: For each state 𝑥, VectorMaton greedily selects an indexed descendant 𝑦 with the largest indexed vector set as its inherited index, and constructs a local index only over the residual vector set. Therefore, a query on 𝑥 requires two independent searches, one on its local index and the other on the inherited index of 𝑦, followed by merging their results. This introduces additional search and result-merging overhead compared with searching a single index over the entire vector set. Furthermore, its index construction plan is heuristic and provides no global optimality guarantee. Specifically, VectorMaton makes a greedy, state-wise reuse decision based on the size of a descendant’s indexed set. An ancestor can reuse a descendant as a single index only when the descendant’s complete candidate set is covered by that index, since VectorMaton limits query searches on at most two indices. For example, consider ESA in Fig. 2, 𝑞 7 first builds an index over {𝑣 3 }. States 𝑞 5 and 𝑞 6 can directly reuse this index. States 𝑞 3 and 𝑞 4 inherit the index of 𝑞 7 and each builds a residual index over {𝑣 2 }. State 𝑞 2 builds an index over {𝑣 1 }. For state 𝑞 1 , the indexed sets of 𝑞 7 and 𝑞 2 have the same size, so either choice leaves a residual set of size two. However, 𝑞 1 is then represented by two indexes and cannot be reused by 𝑞 0 as a single complete index. Thus, 𝑞 0 must inherit a single-index descendant such as 𝑞 7 or 𝑞 2 , leaving a residual set of size at least two. Under this greedy plan, the index objects
Jiadong Xie, Hao Jiang, Yingfan Liu, Jeffrey Xu Yu, Hui Li, and Jiangtao Cui
$$q_1\\\mathcal{O}=\{v_1,v_2,v_3\}$$ a
$$q_2\\ {\textt {ab}\}$$
b
b
$$q_3\\ {\textt {abb}\}$$
b
$$q_1\\ {\text t{a}\}$$
$$q_5\\\{\texttt{abbb},\texttt{bbb}\}$$
a $ q_0\ emptyset$
b
b $$q_4\\ {\text t{b}\}$$
b
a
$$q_1\\\mathcal{O}=\{v_1,v_2,v_3\}$$ a
$$q_2\\\mathcal{O}=\{v_1\}$$
$$q_0\\\mathcal{O}=\{v_1,v_2,v_3\}$$
$$q_3\\\mathcal{O}=\{v_2,v_3\}$$
b
$$q_0\\\mathcal{O}=\{v_1,v_2,v_3\}$$
$$q_5\\\mathcal{O}=\{v_3\}$$
b
b $$q_4\\\mathcal{O}=\{v_2,v_3\}$$
b
$$q_6\\\mathcal{O}=\{v_3\}$$
b
$$q_5\\\mathcal{O}=\{v_3\}$$
b b
$$q_7\\\mathcal{O}=\{v_3\}$$
b $$q_3\\\mathcal{O}=\{v_2,v_3\}$$
b
$$q_0\\\text{index of }\{v_1,v_2,v_3\}$$
$$q_1\\\text{no index, use }q_0$$
$$q_3\\\text{index of }\{v_2,v_3\}$$
$$q_2\\\text{index of }\{v_1\}$$
$$q_4\\\text{index of }\{v_3\}$$
$$q_4\\\mathcal{O}=\{v_3\}$$ $$q_5\\\text{no index, use }q_4$$
$$q_6\\ {\textt {bb}\}$$
Figure 1: A SA of String abbb
Figure 2: An ESA of Strings {𝑠 1 = aa, 𝑠 2 = ab, 𝑠 3 = abbb}
associated with 𝑞 7 , 𝑞 3 , 𝑞 4 , 𝑞 2 , 𝑞 1 , and 𝑞 0 store 8 vectors in total. In contrast, if we build one complete index for 𝑞 1 over {𝑣 1, 𝑣 2, 𝑣 3 }, then 𝑞 0 can directly reuse the index of 𝑞 1 . The resulting plan keeps five indices and stores 7 vectors in total. As a result, locally attractive reuse decisions may lead to a suboptimal total index cost, leaving opportunities for further index sharing unexplored and potentially incurring unnecessary graph construction. String-Aware Retrieval and Issues: Dense-sparse ANN methods [10, 19, 47] jointly score vector similarity and lexical relevance. Although lexical representations can capture substrings, they provide only a soft matching signal rather than the exact Boolean condition that 𝑠𝑞 must occur as a contiguous substring. Thus, densesparse search cannot simultaneously guarantee both accurate filtering and high-quality 𝑘-ANN retrieval in our setting, since filtering needs higher weight on sparse vectors while 𝑘-ANN needs higher weight on dense vectors. Moreover, adapting these methods requires retrieving an enlarged candidate set and verifying the substring predicate afterward, which incurs cost on irrelevant candidates’ distance computations and additional predicate verifications. General Filtered ANN Index and Issues: General filtered-ANN techniques include pre-filtering [34, 37, 48], post-filtering [34, 37, 45], and graph-search variants that incorporate the predicate during traversal [27, 48]. Although these methods usually have lower index cost, this advantage is often less decisive in practice than search efficiency. By contrast, their search efficiency is highly sensitive to predicate selectivity. Pre-filtering becomes expensive when the qualifying set is large, whereas post-filtering and graph-based methods may visit many objects that do not satisfy the substring predicate. Since vector-distance evaluation dominates proximity graph search [15, 43], such visits translate directly into redundant computations and unstable performance across query regimes.
4
$$q_2\\\mathcal{O}=\{v_1\}$$
a
b
A New Multi-Proximity Graph Index
To address the issues of string-aware retrievals and general filtered ANN indices for achieving optimal search performance on substring filtered ANN, an ideal scenario involves an index that, for each query substring 𝑠𝑞 , can provide a separate proximity graph built only over vectors whose attribute contains 𝑠𝑞 . Such a graph would avoid visiting non-qualifying nodes altogether. However, the number of distinct substrings across the dataset is quadratic Í in string length, i.e., 𝑂 ( 𝑛𝑖=1 |𝑠𝑖 | 2 ) for set {𝑠 1, · · · , 𝑠𝑛 }, so building a graph per substring is infeasible in both space and build time. The key observation, inspired by the suffix automaton, is that different substrings may induce exactly the same candidate object set. Therefore, instead of building one index for every distinct substring, it is sufficient to build graphs only for equivalence classes of substrings that share the same satisfying object set. However,
Figure 3: An MultiSA of Strings {𝑠 1 = aa, 𝑠 2 = ab, 𝑠 3 = abbb}
Figure 4: A Link Tree of MultiSA in Fig. 3
the existing ESA does not guarantee to achieve a minimized state automaton; hence, to address ➀ Automaton Issue, we first design a state-minimized suffix automaton for our problem, called MultiSA. We discuss the MultiSA with examples in detail. MultiSA: In MultiSA, each state represents all substrings that produce the same object set after every possible continuation. Specifically, Let 𝐹 (𝑝) = {𝑖 ∈ [1, 𝑛] | 𝑝 is a substring of 𝑠𝑖 }. Two substrings 𝑝 and 𝑞 can share an automaton state only if ∀𝑥 ∈ Σ∗, 𝐹 (𝑝𝑥) = 𝐹 (𝑞𝑥). This condition includes the current output (𝑥 = ∅) and every possible continuation. Note that merely having 𝐹 (𝑝) = 𝐹 (𝑞) is insufficient, since the two substrings may admit different future extensions. For instance, the state 𝑞 3 and 𝑞 4 in ESA shown in Fig. 2 is merged as 𝑞 3 in MultiSA shown in Fig. 3, since for every continuation 𝑥 ∈ Σ∗ , Oab𝑥 = Ob𝑥 always holds. As in a suffix automaton, a substring is represented by a path from the initial state 𝑞 0 , with edge labels spelling the substring. The object set associated with a state 𝑢, denoted by 𝑢.O, is the set of objects whose attributes contain 𝑝 as a substring. For example, Fig. 3 shows a MultiSA constructed over the object set {(𝑣 1, aa), (𝑣 2, ab), (𝑣 3, abbb)}. Node 𝑞 3 represents the substrings ab and b, corresponding to the two paths from 𝑞 0 to 𝑞 3 . It represents the object set {𝑣 2, 𝑣 3 }, because both objects contain at least one substring represented by 𝑞 3 . The construction details, minimization procedure, and proof of MultiSA are given in Section 6.1. Based on MultiSA, we can design a multiple proximity graph index, SURF, where each state in MultiSA, built from the string set {𝑠𝑖 |𝑜𝑖 = (𝑣𝑖 , 𝑠𝑖 ) ∈ O}, contains a proximity graph. Specifically, to construct SURF, we construct proximity graphs, e.g., HNSW [22], for 𝑝.O of every node 𝑝 in MultiSA. Search Algorithm on SURF: Given a query 𝑞 = (𝑣𝑞 , 𝑠𝑞 ), recall that in MultiSA, each node represents the substrings spelled by the concatenation of edge labels along any path from 𝑞 0 to that node. Thus, to process the query, we start at 𝑞 0 and follow the edge labels to locate the node representing 𝑠𝑞 , and then perform 𝑘-ANN search on the proximity graph associated with that node. As shown in Algorithm 2, the search starts at 𝑞 0 in MultiSA (line 1). We navigate 𝑐𝑢𝑟 to the node representing 𝑠𝑞 through the transitions labeled 𝑐𝑖 of 𝑠𝑞 sequentially (lines 2, 4), and terminate the search immediately if such a node is not found (line 3). Upon locating the node, we conduct a beam search on 𝐺 of this node to obtain the final 𝑘-ANN result (lines 5-6). Note that 𝐺 here is built exactly based on the set of objects that satisfy the query predicate, achieving the ideal search scenario we discussed before. However, although MultiSA has minimized the number of states in ESA for lower index construction cost, both space consumption and construction time of SURF are still up to a factor of the average string length compared with the original single proximity graph.
SURF: Substring Filtered Approximate Nearest Neighbor Search
𝑣$
Algorithm 2: SURFSearch (I, 𝑣𝑞 , 𝑠𝑞 , 𝑘, 𝑤) Input : index I, query 𝑞 = (𝑣𝑞 , 𝑠𝑞 ), 𝑘 for top-𝑘 and beam width 𝑤 Output : 𝑘-ANN result 1 𝑐𝑢𝑟 ← 𝑞 [0]; 2 for each 𝑐 𝑖 ∈ 𝑠𝑞 in string order do 3 if 𝑐𝑢𝑟 .Δ[𝑐𝑖 ] = ∅ then return ∅; 4 else 𝑐𝑢𝑟 ← 𝑐𝑢𝑟 .Δ[𝑐𝑖 ];
𝑣$
𝑣$ 𝑣&
𝑣#
𝑣"
(a) 𝑞$
𝑣#
(b) 𝑞" &𝑞$
𝑣"
𝑣!
𝑣"
𝑣#
(c) 𝑞% &𝑞& &𝑞#
𝑣&
𝑣%
𝑣! 𝑣#
(d) 𝑞' &𝑞% &𝑞& &𝑞#
Figure 5: An Example of Path Compression
5 𝐺 ← the proximity graph of 𝑐𝑢𝑟 containing 𝑐𝑢𝑟 . O; 6
return BeamSearch (𝐺, 𝑣𝑞 , 𝑘, 𝑤);
Therefore, to make the index scalable in practice, we consider compressing it. VectorMaton provides a way to compress the proximity graphs among states in an automaton; however, as discussed in ➁ index reuse issue, it does not provide any theoretical guarantee on compressed quality and does not fully utilize the relationships among states as shown below. The key observation is that, for any two substrings 𝑠 1 and 𝑠 2 , if 𝑠 1 is a suffix of 𝑠 2 , then the object set corresponding to 𝑠 2 must be a subset of that corresponding to 𝑠 1 . The reason is that any object whose string contains 𝑠 2 as a substring must also contain 𝑠 1 , since 𝑠 1 is itself a substring of 𝑠 2 . Based on this property, as we will prove in Section 6 later, the nodes in MultiSA induce a tree structure, which we refer to as link tree. We discuss it in detail with examples. Link Tree: A link tree is a tree rooted at 𝑞[0] and can be represented as a graph G = (V, E), where V = V is MultiSA state set. An edge from 𝑝 to 𝑢 in E is a parent-child edge, indicating the strings represented by 𝑝 are the longest suffixes of those represented by 𝑢. Thus, 𝑢.O ⊆ 𝑝.O always holds. For example, the link tree corresponding to MultiSA shown in Fig. 3 is illustrated in Fig. 4. Consider nodes 𝑞 3 , 𝑞 4 , and 𝑞 5 , which represent strings {b, ab}, {bb, abb}, and {bbb, abbb}, respectively. Since both {b, ab} and {bb, abb} are suffixes of {bbb, abbb}, but {bb, abb} have the larger length, the parent of 𝑞 5 is 𝑞 4 . Based on the link tree, in which the parent of each node corresponds to a superset of the child’s object set, we introduce two complementary compression rules. (1) Path compression stores a sequence of logical graph versions in one physical graph by incrementally inserting the set differences between adjacent retained states. (2) Ancestor compression avoids materializing a logical index for a state when its candidate set is sufficiently large relative to the candidate set of an already retained ancestor. The serving ancestor is not necessarily the direct parent; it can be the nearest retained ancestor on the link-tree path. We describe these two rules in detail below. Path Compression: Consider a path 𝑝 1, 𝑝 2, · · · , 𝑝𝑚 from a lowerdepth node to a higher-depth node in the link tree. Since 𝑝𝑚 .O ⊆ 𝑝𝑚−1 .O ⊆ · · · ⊆ 𝑝 1 .O, the proximity graphs on these nodes can be constructed incrementally from 𝑝𝑚 to 𝑝 1 , i.e., for each node 𝑝𝑖 with 𝑖 < 𝑚, we derive it from the graph of 𝑝𝑖+1 by inserting the vectors in 𝑝𝑖 .O \ 𝑝𝑖+1 .O. In this way, we do not need to build 𝑚 separate proximity graphs for 𝑝 1, 𝑝 2, · · · , 𝑝𝑚 . Instead, we only need to record the changes during this incremental construction process, i.e., the edges added and the edges pruned, so that the proximity graph of each node can be efficiently recovered from these records.
Example 4.1: Adding objects 𝑜 4 = {𝑣 4, abb}, 𝑜 5 = {𝑣 5, abb} and 𝑜 6 = {𝑣 6, ab} into MultiSA shown in Fig. 3, the only differences are the object set of states. Considering four states 𝑞 0, 𝑞 3, 𝑞 4, 𝑞 5 , we have 𝑞 0 .O = {𝑣 1, 𝑣 2, · · · , 𝑣 6 }, 𝑞 3 .O = {𝑣 2, 𝑣 3, · · · , 𝑣 6 }, 𝑞 4 .O = {𝑣 3, 𝑣 4, 𝑣 5 }, and 𝑞 5 .O = {𝑣 3 }. As illustrated in Fig. 5, we first construct the index for 𝑞 5 with vector 𝑣 3 . We then insert 𝑣 4 and 𝑣 5 to obtain the index for 𝑞 4 . Next, for 𝑞 3 , we insert 𝑣 2 and 𝑣 6 , during which the newly added edges prune edge (𝑣 4, 𝑣 5 ). Finally, we insert 𝑣 1 to obtain the index for 𝑞 0 . Throughout this process, we record all index updates, and pruned edges are not physically removed. As a result, we only need to store the recorded index evolution along the path 𝑞 5, 𝑞 4, 𝑞 3, 𝑞 0 , from which the graph of any node on the path can be extracted. Ancestor Compression: Let 𝑢 be a state and let 𝑎 be an ancestor of 𝑢 in the link tree whose logical index is retained. Since 𝑢.O ⊆ 𝑎.O, the index of 𝑎 can serve queries on 𝑢 by verifying the original substring predicate after retrieving. We skip index construction for 𝑢 when |𝑢.O|/|𝑎.O| ≥ 𝛼. Importantly, 𝑎 is not necessarily a direct parent of 𝑢. Here, |𝑢.O|/|𝑎.O| is the selectivity, and 𝛼 is predefined and is set as 0.3 by default. This compression rule needs to be integrated with methods from the post-filtering strategy. According to the results in existing work [9, 42, 48, 49], the post-filtering demonstrates effectiveness, even similar to search on a dedicated proximity graph index, when the selectivity of the query filter is high. In particular, when a search is required on such state 𝑢, we employ beam search on the proximity graph of 𝑎 to retrieve all 𝑤 results in 𝑆, rather than just obtaining the top-𝑘 results. Next, we check all 𝑤 vectors to ascertain if their string attributes satisfy the filter to derive the final top-𝑘 results. For example, in Fig. 4, we do not build an index for 𝑞 1 , but instead reuse the index of 𝑞 0 to support queries on them, since the selectivity |𝑞 1 .O|/|𝑞 0 .O| = 1 is high. For search, we perform beam search with beam width 𝑤 > 𝑘 on the index of 𝑞 0 , and then discard nodes in 𝑞 0 .O \ 𝑞 1 .O (∅ here) if it appears among the 𝑤 retrieved results before returning the final top-𝑘 answers. To apply the two compression rules optimally for minimizing the index cost of SURF, we propose a dynamic programming method in Section 5 that jointly considers both rules and computes the optimal compression plan. Based on these rules, together with SURF search algorithm and the post-filtering strategy used for parent node compression, we develop ComSURF. ComSURF significantly reduces index size and building time, while preserving, and often even improving, search performance. Details are given in Section 6.
5
Optimal Compression Strategy
In this section, we jointly optimize path compression and ancestor compression on the link tree of MultiSA. We formulate the problem as an exact dynamic program (DP) and then exploit the monotonicity of candidate-set sizes to obtain an efficient implementation.
Jiadong Xie, Hao Jiang, Yingfan Liu, Jeffrey Xu Yu, Hui Li, and Jiangtao Cui
Let 𝑤 (𝑢) = |𝑢.O| be the candidate-set size of an active state 𝑢, i.e., a state for which an index is considered. States with 𝑤 (𝑢) ≤ 𝑒 𝑓min are handled by exact scanning and are excluded from the graphplanning tree. Since candidate sets are nested along link-tree edges, 𝑤 (𝑢) ≤ 𝑤 (𝑝𝑎𝑟𝑒𝑛𝑡 (𝑢)). The remaining active states form a rooted tree containing the root whenever graph indexing is enabled. Each active state has one of three roles: ① Skipped state: no logical index is retained at 𝑢; its query is served by the nearest retained ancestor. ② Path anchor: 𝑢 starts a physical proximity-graph path and contributes 𝑤 (𝑢) to the index-cost proxy. ③ Path continuation: 𝑢 retains a logical graph version by extending the physical path of its direct parent. The distinction between a logical index and a physical graph is important. A skipped state is served by the nearest retained ancestor 𝑎, which may be a path anchor or an internal logical version. Its eligibility condition is 𝑤 (𝑢) ≥ 𝛼𝑤 (𝑎), where 𝛼 ∈ [0, 1] is the selectivity threshold. At query time, the system searches the version associated with this actual owner and applies the original substring predicate to the retrieved candidates. A path continuation, in contrast, must be connected to its direct parent because the physical graph is built by incremental insertion along adjacent retained states. Our optimization objective is the sum of candidate-set sizes of all physical path anchors, which captures the number of vector insertions across independently materialized paths. We then consider the transition equations between these states. For a node 𝑢, let 𝐼 [𝑢] denote the minimum additional cost in the subtree of 𝑢 when 𝑢 retains a logical graph version and continues the physical path of its parent. Let 𝐴[𝑢] = 𝑤 (𝑢) + 𝐼 [𝑢] be the cost when 𝑢 starts a new physical path. Finally, let 𝐹 [𝑢, 𝑎] be the minimum cost of the subtree rooted at 𝑢 when 𝑢 is skipped and is served by its nearest retained ancestor 𝑎. This state is feasible only if 𝑤 (𝑢) ≥ 𝛼𝑤 (𝑎). ➀ If 𝑢 is skipped, each child can either start a new path or remain skipped under the same serving Í ancestor: 𝐹 [𝑢, 𝑎] = 𝑣 ∈𝑐ℎ𝑖𝑙𝑑 (𝑢 ) min {𝐴[𝑣], 𝐹 [𝑣, 𝑎]} , where the second term 𝐹 [𝑣, 𝑎] is available only when 𝑤 (𝑣) ≥ 𝛼𝑤 (𝑎). ➁ If 𝑢 is retained, define 𝜇 (𝑢, 𝑣) = min {𝐴[𝑣], 𝐹 [𝑣, 𝑢]} , where 𝐹 [𝑣, 𝑢] is conÍ sidered only if 𝑤 (𝑣) ≥ 𝛼𝑤 (𝑢), and let 𝑆𝑢 = 𝑣 ∈𝑐ℎ𝑖𝑙𝑑 (𝑢 ) 𝜇 (𝑢, 𝑣). At most one direct child can continue the same physical path. Choosing such a child 𝑣 replaces 𝜇 (𝑢, 𝑣) by 𝐼 [𝑣]. Hence, 𝐼 [𝑢] = 𝑆𝑢 −max 0, max𝑣 ∈𝑐ℎ𝑖𝑙𝑑 (𝑢 ) {𝜇 (𝑢, 𝑣) − 𝐼 [𝑣]} , and 𝐴[𝑢] = 𝑤 (𝑢)+𝐼 [𝑢]. For a leaf, 𝐼 [𝑢] = 0 and 𝐴[𝑢] = 𝑤 (𝑢). The root cannot be served by an ancestor, so the optimal cost is 𝐴[𝑟𝑜𝑜𝑡]. This formulation is exact, but explicitly maintaining all feasible ancestor contexts can require quadratic space and time on a long tree. We therefore remove the ancestor identity from the DP state. The serving ancestor affects a skipped subtree only through the threshold 𝛼𝑤 (𝑎). Let 𝑡 denote this threshold, and define 𝐻𝑢 (𝑡) as the minimum cost of the subtree rooted at 𝑢 when 𝑢 is not connected to the path above it and may either start a new path or be skipped under an external retained ancestor with threshold 𝑡. Then ∑︁ min 𝐴[𝑢], 𝐻 𝑣 (𝑡) , 𝑡 ≤ 𝑤 (𝑢), 𝐻𝑢 (𝑡) = . In particular, 𝑣 ∈𝑐ℎ𝑖𝑙𝑑 (𝑢 ) 𝐴[𝑢], 𝑡 > 𝑤 (𝑢). 𝜇 (𝑢, 𝑣) = 𝐻 𝑣 (𝛼𝑤 (𝑢)). This recurrence is equivalent to the ancestorcontext DP, but represents all possible serving ancestors through
Algorithm 3: CompressRule (G, 𝛼) Input : a link tree G, and threshold 𝛼 Output : the optimal compression plan 1 for each node 𝑢 in bottom-up order do 2 if 𝑐ℎ𝑖𝑙𝑑 (𝑢 ) = ∅ then 3 𝐼 [𝑢 ] ← 0; 𝐴[𝑢 ] ← 𝑤 (𝑢 ); 𝐸𝑢 ← { (𝑤 (𝑢 ), 𝑤 (𝑢 ) ) }; 4 continue; 5 6 7 8 9 10 11 12 13 14
for each child 𝑣 of 𝑢 do Consume from 𝐸 𝑣 all events with 𝑘 < 𝛼 𝑤 (𝑢 ) into 𝑏𝑎𝑠𝑒 [𝑣 ]; 𝜇 (𝑢, 𝑣) ← 𝑏𝑎𝑠𝑒 [𝑣 ]; Í 𝑆𝑢 ← 𝑣 ∈𝑐ℎ𝑖𝑙𝑑 (𝑢) 𝜇 (𝑢, 𝑣); 𝑝𝑖𝑐𝑘 [𝑢 ] ← arg max𝑣 ∈𝑐ℎ𝑖𝑙𝑑 (𝑢) {𝜇 (𝑢, 𝑣) − 𝐼 [𝑣 ] } if this maximum is positive; otherwise 𝑝𝑖𝑐𝑘 [𝑢 ] ← ∅; 𝐼 [𝑢 ] ← 𝑆𝑢 − max(0, max𝑣 ∈𝑐ℎ𝑖𝑙𝑑 (𝑢) {𝜇 (𝑢, 𝑣) − 𝐼 [𝑣 ] } ); 𝐴[𝑢 ] ← 𝑤 (𝑢 ) + 𝐼 [𝑢 ]; Merge the remaining child event maps using small-to-large; Cap the event sum at 𝐴[𝑢 ] − 𝑆𝑢 , and add the residual at key 𝑤 (𝑢 ) if needed; 𝑏 [𝑢 ] ← largest key in the resulting event map;
Reconstruct roles top-down, carrying the nearest retained owner 𝑎; Skip 𝑢 iff 𝛼 𝑤 (𝑎) ≤ 𝑏 [𝑢 ]; otherwise start a new path; 17 return 𝑝𝑖𝑐𝑘, 𝑏, and the reconstructed path and owner assignments; 15
16
one scalar threshold. Each 𝐻𝑢 is a nondecreasing step function, and its breakpoints occur only at candidate-set sizes of states in the subtree. We represent 𝐻𝑢 using a finite event set 𝐸𝑢 , where each event (𝑘, Δ) ∈ 𝐸𝑢 records a positive increment Δ that takes effect when the threshold 𝑡 becomes strictly larger than 𝑘, i.e., Í 𝐻𝑢 (𝑡) = (𝑘,Δ) ∈𝐸𝑢 : 𝑘<𝑡 Δ. We store a consumed prefix as a base value and keep only future events in an ordered map. As shown in Algorithm 3 with input of a link tree G and parameter 𝛼, we process each state 𝑢 bottom-up (line 1), and initialize at leaf nodes (lines 2-4). We first query each child function at 𝑡𝑢 = 𝛼𝑤 (𝑢), then consume events with keys strictly smaller than 𝑡𝑢 into the child’s base (lines 6-7). The sum of the resulting child bases is 𝑆𝑢 (line 8), and the largest saving determines the child selected for path continuation (line 9). The node then obtains 𝐼 [𝑢] and 𝐴[𝑢] from the recurrence above (lines 10-11). The remaining child events are merged, capped so that their total does not exceed 𝐴[𝑢] − 𝑆𝑢 , and, if necessary, completed by an event at key 𝑤 (𝑢) (lines 12-13). For every active node with positive candidate count, the final function has a positive jump, i.e., 𝐴[𝑢] > 𝑆𝑢 . To see this, the path saving at 𝑢 is strictly smaller than 𝑤 (𝑢); otherwise, a child of equal weight would have to attain its anchor cost at the same threshold, contradicting the inductive strict inequality for that child. Thus, the capped event map is nonempty, and its largest key 𝑏 [𝑢] is well-defined. Let 𝑏 [𝑢] be the largest key of the final event map of 𝑢. Since the event representation is nondecreasing and its final value is 𝐴[𝑢], we have 𝐻𝑢 (𝑡) < 𝐴[𝑢] ⇔ 𝑡 ≤ 𝑏 [𝑢]. The left-hand side means that reusing the given ancestor is strictly cheaper than starting a new path. During top-down reconstruction, we therefore carry the nearest retained owner 𝑎. A node is skipped exactly when 𝛼𝑤 (𝑎) ≤ 𝑏 [𝑢]; otherwise it starts a new path and becomes the serving owner for its skipped descendants. If a retained node is
SURF: Substring Filtered Approximate Nearest Neighbor Search
selected as the continuation child of its parent, it is attached to that parent’s physical path. Theorem 5.1: Algorithm 3 returns a feasible plan minimizing the total candidate-set size of all physical path anchors. Proof Sketch: The ancestor-context recurrence enumerates every feasible role of a node and, when the node is retained, every possible direct child that continues its physical path. Once this choice is fixed, the remaining child subtrees are independent. The thresholdfunction recurrence is an exact reparameterization of the ancestor context because the latter is used only through 𝛼𝑤 (𝑎). The bottomup event operations evaluate this recurrence exactly, while the boundary 𝑏 [𝑢] preserves precisely the strict comparison needed for top-down reconstruction. Induction from leaves to the root establishes optimality. □ Time Complexity: Let 𝑚 be the number of active nodes. Each node contributes at most one new event. Events consumed by an ancestor or removed by the cap never reappear. The event maps are merged small-to-large, selecting the heavy child by active-subtree size. Thus, each surviving event is migrated across at most 𝑂 (log 𝑚) light edges, and each map operation costs 𝑂 (log 𝑚). The total planning complexity is therefore 𝑂 (𝑚 log2 𝑚) time.
6
Compressed Index of SURF
In this section, we detail the construction of ComSURF. We first present the smallest deterministic state-output automaton for our problem and its construction details. We then introduce the link tree, which exposes the containment relationships used by the two compression rules. Finally, we explain how path compression and ancestor compression are realized by the physical index and how the optimal plan is reconstructed.
6.1
State-Minimized Suffix Automaton
The multi-string suffix automaton in [38] groups substrings by their occurrence-position lists. For substring filtered ANN, however, a query needs only the set of object IDs whose strings contain the substring; occurrence positions are not part of the consideration. We therefore minimize states with respect to the output function 𝐹 (𝑝) defined in Section 4, while preserving all future transitions. For two substrings 𝑝 and 𝑞, define 𝑝 ≡𝐹 𝑞 iff ∀𝑥 ∈ Σ∗, 𝐹 (𝑝𝑥) = 𝐹 (𝑞𝑥). This is the coarsest equivalence relation that permits deterministic state merging. Equality of the current candidate sets alone is not sufficient; for example, for a dataset containing the single string ab, both a and b output the same object ID, but appending b distinguishes them because ab exists whereas bb does not. Let 𝛿 (𝑢, 𝑐) be the transition from state 𝑢 on character 𝑐, and let [𝑣] denote the equivalence class of state 𝑣 in the minimized automaton. Since character transitions form a DAG, we compute the quotient bottom-up in reverse topological order. The signature of a state is defined as 𝑠𝑖𝑔(𝑢) = (𝑢.O, {(𝑐, [𝛿 (𝑢, 𝑐)]) | 𝑐 ∈ Σ, 𝛿 (𝑢, 𝑐) ≠ ∅}) . Two states are merged exactly when their complete signatures match. We use hashing to efficiently locate candidate signatures and verify the full ID arrays and transition lists before merging. Theorem 6.1: The quotient obtained by merging states with identical signatures is the minimal deterministic state-output automaton.
Proof Sketch: If two substrings reach the same state in any correct deterministic state-output automaton, then every common continuation must produce the same output. Hence, no machine can merge substrings that are not equivalent under ≡𝐹 . Conversely, ≡𝐹 is a right congruence: if 𝑝 ≡𝐹 𝑞, then 𝑝𝑐 ≡𝐹 𝑞𝑐 for every character 𝑐. Therefore, the equivalence classes define a deterministic quotient whose output is well-defined and equals 𝐹 (𝑝). The quotient reaches the lower bound and is minimal. □ We construct MultiSA by inserting the object strings T = {𝑠 1, . . . , 𝑠𝑛 } one by one with gray lines in Algorithm 1. Before inserting a new string, we reset 𝑙𝑎𝑠𝑡 to the initial state 𝑞 0 (line 3), thereby preventing transitions from representing substrings that cross string boundaries. During character insertion, if 𝑙𝑎𝑠𝑡 already has a transition labeled by the new character (line 12), we reuse its target when its maximum length is 𝑙𝑎𝑠𝑡 .𝑙𝑒𝑛 + 1; otherwise, we split the target state as in the standard SA construction (lines 13-17). Meanwhile, the vector associated with each string is attached to the end states of its prefixes, and a reverse traversal of suffix links propagates these vectors to all states representing their substrings (lines 28-29). Í Time Complexity: Let 𝐿 = 𝑛𝑖=1 |𝑠𝑖 | be the total length of all input strings, 𝐿max = max𝑖 |𝑠𝑖 |, and Σ be the alphabet. The MultiSA construction creates 𝑄 = 𝑂 (𝐿) states and 𝑇 = 𝑂 (𝐿|Σ|) transitions, and takes 𝑂 (𝐿) time under constant-time transition operations and Í amortized suffix-link traversal. Let 𝐵 = 𝑢 ∈ V |𝑢.O| denote the total number of candidate-ID entries across all base states. Given sorted candidate-ID arrays, computing state signatures and verifying candidate matches takes expected 𝑂 (𝐵 + 𝑇 + 𝑄) time using hashing. To process states in reverse topological order, we bucketsort them by their maximum represented substring length, which takes 𝑂 (𝑄 + 𝐿max ) time. Sorting outgoing transitions by character takes 𝑂 (𝑇 + 𝑄) time for a bounded alphabet. Therefore, the total expected time complexity is 𝑂 (𝐵 + 𝑇 + 𝑄 + 𝐿max ). Combining base construction and minimization, the overall expected preprocessing time is 𝑂 (𝐵 + 𝐿|Σ|). Since 𝐵 = 𝑂 (𝐿 1.5 ) in the worst case, the overall expected time is 𝑂 (𝐿 1.5 ) for a bounded alphabet.
6.2
Tree Structure among MultiSA Nodes
After state minimization, multiple original states may be merged into a single state in MultiSA. Therefore, the parent of a minimized state cannot be directly defined as the suffix link of an arbitrary original state in its equivalence class. We define the parent by skipping the original suffix links within the same equivalence class. Specifically, let G0 denote the automaton before minimization, and let 𝜋 : V0 → V map each original state to its corresponding state in MultiSA. For each minimized state 𝑝 ≠ 𝑞 0 , let 𝑢𝑝 be the original state in 𝜋 −1 (𝑝) with the smallest maximum represented substring length. We define its parent as 𝑝.𝑙𝑖𝑛𝑘 = 𝜋 (𝑢𝑝 .𝑙𝑖𝑛𝑘 0 ), where 𝑙𝑖𝑛𝑘 0 denotes the original suffix-link function before minimization. That is, the parent of 𝑝 is the minimized state reached by following the original suffix link from the shortest state in its equivalence class. The root state 𝑞 0 has no parent. The following theorem establishes that these parent relations form a tree and preserve the candidate-set containment property required by both compression rules.
Jiadong Xie, Hao Jiang, Yingfan Liu, Jeffrey Xu Yu, Hui Li, and Jiangtao Cui
Theorem 6.2: The parent relations defined above form a tree rooted at 𝑞 0 . Moreover, if 𝑞 is an ancestor of 𝑝 in this tree, then 𝑝.O ⊆ 𝑞.O. Proof Sketch: We first establish that every equivalence class under ≡𝐹 forms a contiguous chain under the original suffix links. For an object string 𝑠𝑖 and a substring 𝑥, define 𝑅𝑖 (𝑥) = {𝑧 ∈ Σ∗ | 𝑥𝑧 is a substring of 𝑠𝑖 }. By the definition of ≡𝐹 , if 𝑝 ≡𝐹 𝑞, then 𝑅𝑖 (𝑝) = 𝑅𝑖 (𝑞) for every object 𝑖. Let 𝑒𝑖 (𝑥) denote the earliest ending position of an occurrence of 𝑥 in 𝑠𝑖 . The maximum length of a valid continuation in 𝑅𝑖 (𝑥) is |𝑠𝑖 | − 𝑒𝑖 (𝑥). Therefore, 𝑒𝑖 (𝑝) = 𝑒𝑖 (𝑞). Consequently, if |𝑝 | < |𝑞|, then 𝑝 is a suffix of 𝑞. Now consider any suffix 𝑟 of 𝑞 such that |𝑝 | < |𝑟 | < |𝑞|. Since 𝑝 is a suffix of 𝑟 , and 𝑟 is a suffix of 𝑞, for every object 𝑖 we have 𝑅𝑖 (𝑞) ⊆ 𝑅𝑖 (𝑟 ) ⊆ 𝑅𝑖 (𝑝). As 𝑅𝑖 (𝑝) = 𝑅𝑖 (𝑞), it follows that 𝑅𝑖 (𝑟 ) = 𝑅𝑖 (𝑝) for every object 𝑖. Hence, 𝑝 ≡𝐹 𝑟 ≡𝐹 𝑞. In a suffix automaton, the states representing successive suffixes of a string are encountered along its suffix-link chain. Thus, all original states belonging to the same equivalence class form a contiguous chain under the original suffix links. Furthermore, the state with the smallest maximum represented substring length in each equivalence class is unique. Otherwise, two distinct states with the same minimum length would represent the same shortest substring, which cannot reach two distinct states in a deterministic automaton. We can therefore contract each equivalence class into one state in MultiSA. By the construction of the original multi-string suffix automaton, every non-root state has exactly one suffix link, and following this link strictly decreases its maximum represented substring length. Hence, repeatedly following suffix links from any non-root state eventually reaches 𝑞 0 , and the original suffix-link relations form a rooted tree. Since each equivalence class forms a contiguous chain in this tree, contracting these chains preserves the rooted-tree structure. Moreover, the parent of each contracted state is precisely the first state outside its equivalence class encountered along the original suffix-link chain, which agrees with the definition of 𝑝.𝑙𝑖𝑛𝑘 above. Therefore, the parent relations form a rooted tree with 𝑞 0 as its root. It remains to establish candidate-set containment. For any original suffix-link edge 𝑢 → 𝑢.𝑙𝑖𝑛𝑘 0 , every substring represented by 𝑢.𝑙𝑖𝑛𝑘 0 is a suffix of a substring represented by 𝑢. Therefore, every object containing a substring represented by 𝑢 also contains its represented suffix, yielding 𝑢.O ⊆ 𝑢.𝑙𝑖𝑛𝑘 0 .O. Applying this property along the original suffix-link chain, and then contracting the chains, gives 𝑝.O ⊆ 𝑞.O, whenever 𝑞 is an ancestor of 𝑝 in the link tree. □
Algorithm 4: PathConstruct (𝐺𝑖 , 𝑝𝑖 , 𝑝 𝑗 , 𝑒 𝑓 𝑐, 𝑀) Input : a proximity graph 𝐺𝑖 of node 𝑝𝑖 and node 𝑝 𝑗 Output : a proximity graph 𝐺 𝑗 of node 𝑝 𝑗 1 𝐺 𝑗 ← 𝐺𝑖 ; 2 for each vector 𝑣 ∈ 𝑝 𝑗 . O \ 𝑝𝑖 . O do 3 𝐶 ←BeamSearch (𝐺 𝑗 , 𝑣, 𝑒 𝑓 𝑐, 𝑒 𝑓 𝑐); 4 utilize RNG pruning strategy to make |𝐶 | ≤ 𝑀; 5 for each node 𝑢 in 𝐶 do 6 add edges (𝑢, 𝑣) and (𝑣, 𝑢 ) with labeled 𝑝 𝑗 to 𝐺 𝑗 ; if |𝑁𝐺 𝑗 (𝑢 ) | > 𝑀 then 7 𝑤 ← node pruned by RNG pruning strategy in 𝑁𝐺 𝑗 (𝑢 ); 8 9 add a label ¬𝑝 𝑗 to edge (𝑢, 𝑤 ) in 𝐺 𝑗 ; 10
return 𝐺 𝑗 ;
We now describe how to construct ComSURF using the optimal compression plan of Section 5. Path compression represents the logical graphs of adjacent retained states along a link-tree path in one physical graph, while ancestor compression skips selected states and serves their queries using the nearest retained ancestor.
graphs, we first construct 𝐺𝑚 on 𝑝𝑚 .O, and then obtain 𝐺𝑖 from 𝐺𝑖+1 for 𝑖 = 𝑚 − 1, . . . , 1 by inserting the vectors in 𝑝𝑖 .O \ 𝑝𝑖+1 .O. Each newly created edge is labeled by the version 𝑝𝑖 in which it becomes visible. If graph pruning removes an older edge from the logical graph of 𝑝𝑖 , we retain the edge physically and attach a negative label ¬𝑝𝑖 . Hence, the final physical graph stored at 𝑝 1 encodes every logical graph 𝐺𝑖 on the path; a query for 𝑝𝑖 simply traverses the edges visible in version 𝑝𝑖 . To add vectors to a proximity graph for constructing a new one, navigable small world graphs, e.g., HNSW [22], a state-of-the-art approach for 𝑘-ANN queries, naturally support vector insertion. Here, we illustrate the process using HNSW as an example to present the details of the construction of such a proximity graph 𝐺 𝑗 for 𝑝 𝑗 based on 𝐺𝑖 of 𝑝𝑖 , as depicted in Algorithm 4, where 𝑒 𝑓 𝑐 and 𝑀 are two hyperparameters in HNSW construction for controlling the size of search beam width and node degree in index respectively. Let 𝐺 𝑗 initially equal 𝐺𝑖 (line 1), followed by the insertion of each vector in 𝑝 𝑗 .O \ 𝑝𝑖 .O (line 2). When inserting a vector 𝑣, we first obtain its 𝑘-ANN as the candidate neighbor set (line 3) and then prune them to ensure the size does not exceed 𝑀 using RNG pruning strategy (line 4). This strategy involves evaluating nodes 𝑢 ∈ 𝐶 of node 𝑣, pruning 𝑢 if there exists 𝑤 ∈ 𝐶 such that 𝛿 (𝑣, 𝑤) < 𝛿 (𝑣, 𝑢) and 𝛿 (𝑢, 𝑤) < 𝛿 (𝑣, 𝑢) simultaneously hold [14, 22]. If |𝐶 | > 𝑀 holds after pruning, the node 𝑢 ∈ 𝐶 with the largest distance to 𝑣 will be removed until 𝐶 ≤ 𝑀. Next, for each node 𝑢 ∈ 𝐶 (line 5), we add edges from 𝑢 to 𝑣 and from 𝑣 to 𝑢 (line 6). The addition of these edges may cause the degree of 𝑢 to surpass 𝑀. Thus, we also apply RNG pruning strategy to limit the size of its neighbor list (line 8). The removed edge will be marked ¬𝑝 𝑗 , which is not truly removed from 𝐺 𝑗 , but excluded from beam searches of node 𝑝 𝑗 and line 3. It is worth noting that incorporating other state-of-the-art methods into Algorithm 4, such as NSG [14], 𝜏-MNG [28], and ALMG [40] for path compression, is feasible. The key distinction lies in these graphs not inherently facilitating vector insertions. Nonetheless, various methods are available to aid in proximity graph maintenance [33, 34, 39, 44]. Therefore, by leveraging these techniques, any proximity graph can be integrated seamlessly.
Path Compression: Consider a path 𝑝 1, 𝑝 2, . . . , 𝑝𝑚 from ancestor to descendant, where 𝑝𝑖 .𝑙𝑖𝑛𝑘 = 𝑝𝑖 −1 for 𝑖 ≥ 2. By Theorem 6.2, 𝑝𝑚 .O ⊆ · · · ⊆ 𝑝 1 .O. Rather than building 𝑚 independent proximity
Theorem 6.3: For a path 𝑝 1, 𝑝 2, · · · , 𝑝𝑚 with 𝑝𝑖 .O ⊆ 𝑝𝑖 −1 .O for all 𝑖 ≥ 2, the versioned graphs constructed from 𝑝𝑚 to 𝑝 1 using Algorithm 4 has 𝑂 (𝑀 · |𝑝 1 .O|) physical adjacency records.
We refer to graph G as the link tree of a MultiSA G. It is obtained by contracting the original suffix-link tree according to the equivalence classes produced by state minimization, and therefore requires no separate tree construction procedure.
6.3
Index Construction
SURF: Substring Filtered Approximate Nearest Neighbor Search
Proof Sketch: The first graph 𝐺𝑚 stores 𝑂 (𝑀 |𝑝𝑚 .O|) edges. Each subsequently inserted vector adds at most 𝑂 (𝑀) new adjacency records; pruning only marks previously created records rather than creating additional graph edges. Since the inserted sets along the path are disjoint and their union is 𝑝 1 .O \ 𝑝𝑚 .O, the total number of records is 𝑂 (𝑀 |𝑝𝑚 .O|) + 𝑂 (𝑀 |𝑝 1 .O \ 𝑝𝑚 .O|) = 𝑂 (𝑀 |𝑝 1 .O|). □ Thus, path compression reduces index-size from Í 𝑂 𝑀 𝑚 for separate graphs to 𝑂 (𝑀 |𝑝 1 .O|) for a 𝑖=1 |𝑝𝑖 .O| shared, versioned graph. Ancestor Compression: Let 𝑢 be a state and 𝑎 its nearest retained ancestor in the link tree. Since 𝑢.O ⊆ 𝑎.O, queries on 𝑢 can use the logical graph version of 𝑎, followed by verification of the original O| substring predicate. We may skip the index at 𝑢 when |𝑢. |𝑎. O | ≥ 𝛼 . We next give the construction details of ComSURF. Index Construction of ComSURF: In summary, to build the compressed SURF, ComSURF, we first construct MultiSA using Algorithm 1 and then minimize it via hashing, as discussed earlier. Next, we derive the link tree by suffix links of each state in MultiSA. For states with |𝑝.O| ≤ 𝑒 𝑓min , we retain the exact candidate sets for direct scanning and omit proximity graph construction. These states are excluded from graph planning without altering their outputs in MultiSA. We then run Algorithm 3 on remaining active link tree to obtain the retained states, compressed paths, and serving ancestors. Finally, we construct one versioned graph for each selected path. ComSURF can support insertions, deletions, and string-attribute updates as discussed below. Dynamic Maintenance: We separate maintenance of the logical automaton from that of the physical proximity graphs. For an insertion (𝑣, 𝑠) with a fresh ID, we incrementally update the underlying multi-string automaton using Algorithm 1. The updated automaton remains exact, while its state-minimization and graph-compression plans are reconciled during periodic consolidation. A new string can split existing states, so the updated automaton may no longer share the compression plan of the physical index. We therefore maintain a stable graph-index snapshot and make recent insertions searchable through a delta layer until consolidation. Queries search the snapshot and the delta layer, verify the substring predicate where necessary, and merge their results. Delta states with at most 𝑒 𝑓min candidates use exact scanning; larger states may maintain their own proximity graphs. Deletions are initially recorded in tombstone bitmaps. Tombstoned vectors are excluded from returned results but may temporarily remain as intermediate graph-traversal connectors. A string-attribute update is processed as a tombstone for the old version followed by insertion of a new version with a fresh internal ID. Periodically, we merge the delta layer into the graph-index snapshot, derive the current link tree, and recompute the compression plan using Algorithm 3. For insertion-only batches, the incrementally maintained MultiSA can be used directly. When deletions or replacements occur, we rebuild MultiSA if multiple states have empty ID sets.
7
Search Algorithms on ComSURF
In this section, we describe query processing on ComSURF. We first show how the compression plan obtained in Section 5 determines
the logical graph used by a substring filtered ANN query. We then extend the search to SQL LIKE predicates. Interpreting the Compression Plan: Algorithm 3 records 𝑝𝑖𝑐𝑘 [𝑢], the child selected to continue the physical path of a retained state 𝑢, and 𝑏 [𝑢], the largest threshold for which skipping 𝑢 is strictly cheaper than starting a new path. Starting from the retained root 𝑞[0], we traverse the active link tree top-down while carrying the nearest retained ancestor 𝑎. For a child 𝑢 of a retained node 𝑝, if 𝑢 = 𝑝𝑖𝑐𝑘 [𝑝], we retain 𝑢 as the next logical version on 𝑝’s physical path. Otherwise, whether 𝑝 is retained or skipped, we skip 𝑢 precisely when 𝛼𝑤 (𝑎) ≤ 𝑏 [𝑢]; if this inequality fails, 𝑢 starts a new physical path. Here 𝑎 = 𝑝 when 𝑝 is retained, and otherwise it is the nearest retained ancestor inherited from above. For each active state 𝑢, the resulting layout identifies its serving owner 𝑜𝑤𝑛𝑒𝑟 (𝑢): 𝑜𝑤𝑛𝑒𝑟 (𝑢) = 𝑢 if 𝑢 is retained, and otherwise 𝑜𝑤𝑛𝑒𝑟 (𝑢) is its nearest retained ancestor. For a retained state 𝑎, let 𝑎𝑛𝑐ℎ𝑜𝑟 (𝑎) be the first (lowest-depth) state of its compressed path, which stores the corresponding physical graph. Both mappings are derived from 𝑝𝑖𝑐𝑘 and 𝑏 during the top-down reconstruction in Section 5. Substring Filtered Queries: For a query 𝑞 = (𝑣𝑞 , 𝑠𝑞 ), we start at 𝑞[0] and follow the character transitions of 𝑠𝑞 in MultiSA. If any transition is missing, the qualifying set is empty and we return no result. Otherwise, we reach a state 𝑢 with 𝑢.O = O𝑠𝑞 . There are three possibilities. ➀ For |𝑢.O| ≤ 𝑒 𝑓min , we directly scan its small candidate set, which gives the exact result. ➁ If 𝑢 is retained, we run beam search on its logical graph version. Every traversed vector then satisfies the substring predicate. ➂ If 𝑢 is skipped, we search the logical version of 𝑎 = 𝑜𝑤𝑛𝑒𝑟 (𝑢) and verify the retrieved candidates against 𝑢.O (equivalently, against the original substring predicate). For this last case, we retain up to 𝑤 candidates when employing beam search before filtering, and return the closest 𝑘 qualifying candidates found. Locating the matching state takes 𝑂 (|𝑠𝑞 |) transition steps. Subsequent work is either an exact scan of at most 𝑒 𝑓min vectors or one beam search over the selected logical graph version, plus at most 𝑤 predicate checks for a skipped state. No additional graph materialization is required during search. LIKE Predicate Queries: A SQL LIKE predicate 𝑙𝑞 may contain %, matching zero or more characters, and _, matching exactly one character. A substring filter 𝑠𝑞 is the special case “LIKE %𝑠𝑞 %”. We first handle the substring-matching interpretation of a wildcard pattern and then enforce any prefix or suffix anchoring required by the complete SQL predicate. Remove the leading and trailing % symbols, if present, to obtain a core pattern 𝑙𝑞 . As shown in Algorithm 5, we maintain a set 𝐶 of possible MultiSA states, initially {𝑞[0]} (line 1). On an ordinary character 𝑐, every state follows its 𝑐-labeled transition (line 5). On _, we follow all one-character outgoing transitions (line 3). On %, we include every state reachable by zero or more character transitions, including the current states (line 4). Thus, 𝐶 contains all possible automaton endpoints for substrings matching the processed core pattern. If 𝐶 becomes empty, no object can satisfy the predicate. Many reachable states are redundant. If states 𝑝, 𝑢 ∈ 𝐶 satisfy that 𝑝 is an ancestor of 𝑢 in the link tree, then 𝑢.O ⊆ 𝑝.O by Theorem 6.2. More importantly, this dominance persists after any common continuation, as formalized below. Therefore, after each
Jiadong Xie, Hao Jiang, Yingfan Liu, Jeffrey Xu Yu, Hui Li, and Jiangtao Cui
Table 1: Statistics of Datasets
Algorithm 5: LIKESearch (I, 𝑣𝑞 , 𝑙𝑞 , 𝑘, 𝑤) Input : index I, query 𝑞 = (𝑣𝑞 , 𝑙𝑞 ), 𝑘 for top-𝑘 and beam width 𝑤 Output : 𝑘-ANN result 1 𝐶 ← {𝑞 [0] }; 2 for each 𝑐 𝑖 ∈ 𝑙𝑞 in string order do Ð 3 if 𝑐𝑖 = _ then 𝐶 ← 𝜎 ∈Σ {𝑢 |𝑝 ∈ 𝐶 ∧ 𝑝.Δ[𝜎 ] = 𝑢 }; 4 else if 𝑐𝑖 = % then 𝐶 ← {𝑢 |𝑝 ∈ 𝐶 ∧ 𝑢 can be reached by 𝑝 }; 5 else 𝐶 ← {𝑢 |𝑝 ∈ 𝐶 ∧ 𝑝.Δ[𝑐𝑖 ] = 𝑢 }; 6 if 𝐶 = ∅ then return ∅; 7 𝐶 ← {𝑢 ∈ 𝐶 | 𝑝 ∈ 𝐶, 𝑝 ≠ 𝑢 ∧ 𝑝 is ancestor of 𝑢 in link tree}; 𝑅 ← ∅; for each 𝑝 ∈ 𝐶 do 10 𝐺 ← the proximity graph of 𝑝 containing 𝑝. O; 11 𝑅 ← 𝑅∪BeamSearch (𝐺, 𝑣𝑞 , 𝑘, 𝑤); 8
9
12
return top 𝑘 vectors with smallest distance to 𝑣𝑞 in 𝑅;
wildcard-navigation step, we remove every state having a distinct ancestor also in 𝐶 (line 7), reducing the number of states carried forward without losing any qualifying object. Theorem 7.1: Let 𝑝 be an ancestor of 𝑢 in the link tree of MultiSA. If the transition 𝑢.Δ[𝑐] exists for a character 𝑐, then 𝑝.Δ[𝑐] also exists and is an ancestor of, or equal to, 𝑢.Δ[𝑐] in the link tree. Hence, removing 𝑢 when 𝑝 is also in the current state set preserves the union of qualifying object sets after any subsequent sequence of ordinary characters and the wildcards % and _. Proof Sketch: A substring represented by 𝑝 is a suffix of a substring represented by 𝑢. Appending same character 𝑐 preserves this suffix relationship. Thus, if a transition on 𝑐 exists from 𝑢, the corresponding transition also exists from 𝑝, and their target states preserve the ancestor relation in the link tree. Applying this argument repeatedly gives the claim for any fixed continuation; _ and % operations take unions over one-character and arbitrary-length continuations, respectively, so the containment remains valid under either wildcard. Since 𝑢.O ⊆ 𝑝.O, discarding 𝑢 does not change the union represented by the current states or by any future update. □ Ð After the core pattern has been processed, the union 𝑢 ∈𝐶 𝑢.O contains every object satisfying the full LIKE predicate. If the pattern begins and ends with %, this union is exactly the qualifying object set. Otherwise, it can be a superset, because MultiSA recognizes substring occurrences rather than enforcing the beginning or end of an object string. In either case, Algorithm 5 runs beam search on each remaining state with a beam width of 𝑤, deduplicates the results, verifies the complete LIKE predicate against each object’s original string, and returns the closest 𝑘 qualifying candidates. Example 7.1: Consider the three strings 𝑠 1 = aa, 𝑠 2 = ab, and 𝑠 3 = abbb in Fig. 3. For the predicate “LIKE %a%b_%”, we first follow the transition on a, and 𝐶 = {𝑞 1 }. Next, expanding all states reachable from 𝑞 1 through zero or more transitions for the internal % yields 𝐶 = {𝑞 1, 𝑞 2, 𝑞 3, 𝑞 4, 𝑞 5 }. 𝑞 2 will be removed because 𝑞 1 is its ancestor, while 𝑞 4 and 𝑞 5 are removed because 𝑞 3 is an ancestor of both. Thus, 𝐶 = {𝑞 1, 𝑞 3 }. Following the transition on b gives 𝐶 = {𝑞 3, 𝑞 4 }, where 𝑞 4 is subsequently removed because 𝑞 3 is its ancestor. Finally, expanding one outgoing transition for _, 𝐶 = {𝑞 4 }, and the union of the resulting states’ candidate sets is {𝑣 3 }.
Dataset Dim. #vectors #queries SIFT 128 GIST 960 Redcaps 512 Deep 256 arXiv 768 Laion 512 DBLP 768 IMDB 1,024
8
1,000,000 1,000,000 1,000,000 1,000,000 157,606 1,000,448 1,000,000 1,000,000
10,000 1,000 1,000 1,000 1,000 10,000 10,000 10,000
|𝑠𝑖 | String Src. Vector Type Source 19.99 20.01 29.99 19.98 99.08 34.11 38.99 29.45
Synthetic Synthetic Synthetic Synthetic Real text Real text Real text Real text
Image Image Image & Text Image Text Image Text Text
[1] [1] [13] [36] [23] [30] [2] [3]
Experiments
Datasets: We employ 8 real-world public datasets along with their queries in our experiments. The summary can be found in Table 1, including vector dimensionality (dim.), the number of base vectors (#vectors), the number of query vectors (#queries), the average length of string attributes in the base set (|𝑠𝑖 |), the source of string attributes (string src.), the vector type, and the dataset source. Base Data. For arXiv and DBLP datasets, vectors are generated using SPECTER2 [32]; for IMDB dataset, vectors are generated using e5-large-v2 [35]. The remaining datasets provide vectors directly. In every dataset, each object 𝑜𝑖 is associated with a string attribute 𝑠𝑖 ∈ Σ∗ . Datasets arXiv, Laion1M, DBLP, and IMDB contain native text metadata, from which we derive 𝑠𝑖 as follows: paper titles for arXiv and DBLP; a truncated caption with a fixed maximum length for Laion1M; and, for IMDB, the concatenation of the person name and the two occupations with the longest tenure. For the remaining datasets, we synthetically generate 𝑠𝑖 by sampling characters from an alphabet Σ consisting of lowercase letters, digits, and punctuation symbols. Unless otherwise specified, we use a Zipf distribution for synthetic string generation. Table 1 reports |𝑠𝑖 | for each dataset, and the String Src. column indicates whether 𝑠𝑖 is synthetic or derived from real-text metadata. Query Data. Unless otherwise specified, we use the standard query set provided by each dataset, which is disjoint from the base vectors. To generate a string predicate for a query vector 𝑣𝑞 while controlling selectivity, we first build a MultiSA over all object strings {𝑠𝑖 }. Each state 𝑝 is associated with a set 𝑝.O of objects whose string attributes contain a substring represented by 𝑝 (as defined in Section 4). Therefore, any representative substring 𝑠𝑞 from state 𝑝 has selectivity 𝑆𝑒𝑙 (𝑠𝑞 ) = |𝑝.O|/|O|. For overall-performance evaluation, we sample MultiSA states such that the resulting queries have an average selectivity around 20% or 30%. Given a selected state 𝑝, we instantiate a concrete predicate by first sampling a length ℓ ∈ {𝑝.link.len + 1, . . . , 𝑝.len}, and then uniformly sampling one substring of length ℓ represented by 𝑝 as the filter string 𝑠𝑞 . Algorithms: We compare our approaches, SURF/ComSURF, with the following seven baselines. For each algorithm, we use recommended parameters if provided, and tune the remaining parameters on each dataset to obtain a Pareto-optimal recall-QPS curve. (1) Pre-filtering [34]: We first materialize the filtered candidate set O𝑠𝑞 by locating 𝑠𝑞 in MultiSA. We then compute distances from 𝑣𝑞 to all candidates in O𝑠𝑞 and return the top-𝑘 results. (2) Postfiltering [34]: We build an HNSW index on the vectors with 𝑀 = 32 and 𝑒 𝑓𝑐 = 256. At query time, we retrieve 𝑘 ′ candidates (𝑘 ′ > 𝑘) using HNSW search and then apply the substring predicate, returning the first 𝑘 qualifying results. (3) Milvus [34]: We build an HNSW
SURF: Substring Filtered Approximate Nearest Neighbor Search
0 0.97
1.00
2 1 0 0.90
8 6 4
0.95 Recall@10
1.00
9 1.00
2 0 0.90
0.95 Recall@10 400 200 0 0.97
0.95 Recall@10
1.00
1.00
QPS (×103)
QPS (×104)
SIFT (Sel = 1%) 2.5 2 1.5 1 0.5 0 0.90
6
0 0.97
1.00
0.95 Recall@10
7 6 5 4 3 2 1 0 0.90
0.95 Recall@10
0.95 Recall@10
2
1.00
0.95 Recall@10 Laion (Sel = 20%) 100 50 0 0.95
0.95 Recall@10
1.2 0.8
1.00
0 0.7
0.95 Recall@10
0 0.90 4
1.00
1.00
1.00
0.8
0.9 Recall@10
1.0
Laion (Sel = 30%) 100 0 0.97
1.00
1
200 1.00
10 5 0 0.90
2
SIFT (Sel = 5%) 0 0.97
1.00
0.4
3
1.00
Recall@10 IMDB (Sel = 20%)
0.8
100
0.95 Recall@10
0 0.98
1.2
1.00
1.00
200
2 0 0.95
DBLP (Sel = 30%) 0 0.97
ComSURF arXiv (Sel = 20%)
4
1.6
0.4 0 0.90
6
1.00
1
1.6 1.00
1.00
1
0 0.90
1.00
DBLP (Sel = 1%) 100 50 0 0.94
2
3 1.00
0 0.97
QPS (×103)
QPS (×103)
Redcaps (Sel = 30%) 100 50 0 0.97
3
0 0.90
1.00
3 0 0.90
1.00
4
100
SURF
200
3 0 0.90
1.00
1 0 0.90
SIFT (Sel = 30%) 200 100 0 0.97
2
6
OneSparse VectorMaton Redcaps (Sel = 20%)
QPS (×103)
3
3
9
QPS (×103)
100
0.95 Recall@10 DBLP (Sel = 20%)
1.00
ACORN-
QPS (×103)
4
1.00
20 10 0 0.97
QPS (×103)
0.95 Recall@10 Deep (Sel = 20%)
Post-filtering ACORN-1 GIST (Sel = 20%)
QPS (×103)
2
QPS (×102)
1.00
10 8 6 4 2 0 0.90
QPS (×104)
QPS (×103)
Pre-filtering
4 0 0.90
QPS (×103)
200 100 0 0.97
QPS (×103)
6
Milvus VBASE SIFT (Sel = 20%)
QPS (×103)
QPS (×103)
8
0.95 Recall@10
1.00
DBLP (Sel = 5%) 100
3
0 0.97
2
1.00
1 0 0.90
0.95 Recall@10
1.00
Figure 6: Overall search performance comparisons under different selectivities (Exp. 1) index with 𝑀 = 32 and 𝑒 𝑓𝑐 = 256. Since Milvus supports LIKE predicates in ANN search, for substring filtering we issue text LIKE "%𝑠𝑞 %", where string attributes are stored as text; for general LIKE evaluation, we directly use the corresponding LIKE predicate in Milvus. (4) ACORN-1 and ACORN-𝛾 [27]: ACORN provides two variants. Following prior studies on filtered ANN search [9, 41, 42], we evaluate both using 𝑀 = 32, 𝑀𝛽 = 64, and 𝑒 𝑓𝑐 = 256. For ACORN-1, we fix 𝛾 = 1; for ACORN-𝛾, we set 𝛾 adaptively based on 𝑆𝑒𝑙 (𝑠𝑞 ). (5) VBASE [48]: We use VBASE with an HNSW index on the vector column (constructed with 𝑀 = 32 and 𝑒 𝑓𝑐 = 256). Queries are issued in SQL by combining a substring predicate on text (via LIKE) with a 𝑘-NN ordering on vec (via <->). (6) OneSparse [10]: We use OneSparse to compute a hybrid score that combines dense and sparse similarities, retrieve the top-𝑘 ′ candidates under this score, and then apply post filtering to return the final 𝑘 results. Following [10], the hybrid score is 𝛼𝛿 (𝑣𝑞 , 𝑣𝑖 ) + (1 − 𝛼)𝛿 (𝑢𝑞 , 𝑢𝑖 ), where 𝑣 and 𝑢 denote the dense and sparse representations, respectively. We tune the weight 𝛼 and use 𝛼 = 0.05, which yields the best performance in our experiments. (7) VectorMaton [38]: We build VectorMaton using the enhanced suffix automaton (ESA) to organize pattern-equivalent vector subsets and construct state indexes with index reuse and skip-build strategies. For fair comparison, we use the same HNSW construction parameters as our approaches, i.e., 𝑀 = 32, 𝑒 𝑓𝑐 = 256, and 𝑇 = 200. At query time, we traverse the ESAM to locate the state corresponding to 𝑠𝑞 , search its local index and inherited index (if any), and merge their results to obtain
the final top-𝑘 results. For LIKE predicate, as VectorMaton only supports _ wildcard, we only compare it with others under this predicate. (8) SURF/ComSURF (ours): For fair comparison, we use the same HNSW construction parameters as above (i.e., 𝑀 = 32 and 𝑒 𝑓𝑐 = 256) for all proximity graphs in SURF/ComSURF. Since the fully uncompressed SURF index is prohibitively large, we evaluate SURF with 𝑒 𝑓min = 2, 000 for a reasonable memory occupation by default. Unless otherwise specified, for ComSURF, we set the parent node compression threshold to 𝛼 = 0.3 and set 𝑒 𝑓min = 200. Performance Metrics: Following prior studies on filtered ANN search [9, 41, 42, 49], we measure efficiency using QPS (queries per second) and accuracy using recall. QPS is the number of queries processed per second, and recall is defined in Section 2. Experimental Environments: Experiments are conducted on a server equipped with an Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz (72 threads) and 376 GB of RAM, running Ubuntu 22.04.5 LTS. All methods are implemented in C++17 and compiled with -Ofast. For index construction, we report build time and index size on the same machine using 64 threads. For search, we set 𝑘 = 10 by default and evaluate query performance using a single thread, following prior work [9, 41, 42, 49]. To reach a target recall, we tune query-time parameters in each method: for post-filtering, we increase the candidate budget 𝑘 ′ ; for other methods, we increase the beam-search width 𝑤 (or the corresponding search parameter) until the desired recall is achieved.
Jiadong Xie, Hao Jiang, Yingfan Liu, Jeffrey Xu Yu, Hui Li, and Jiangtao Cui
Table 2: Index construction time in seconds (Exp. 2)
Table 3: Index size in GB (Exp. 2)
Dataset SURF ComSURF VectorMaton ACORN-1 ACORN-𝛾 HNSW OneSparse
Dataset SURF ComSURF VectorMaton ACORN-1 ACORN-𝛾 HNSW OneSparse
SIFT 2,676 GIST 8,031 Redcaps 4,146 Deep 3,895 arXiv 898 Laion 5,627 DBLP 13,107 IMDB 17,871
SIFT GIST Redcaps Deep arXiv Laion DBLP IMDB
2,372 9,819 3,695 4,168 682 5,747 10,413 9,736
9 40 24 15 4 23 35 40
2,611 7,735 5,478 4,862 1,194 6,154 11,198 13,689
26 134 51 62 7 59 127 177
137 70 56 140 21 121 255 183
Exp. 1: Overall Query Performance under Different Selectivities. We evaluate the overall query performance of ComSURF against all baselines under different selectivities. Fig. 6 reports the QPS-recall trade-offs on all eight datasets at 𝑆𝑒𝑙 (𝑠𝑞 ) ≈ 0.2, and the results on SIFT, Redcaps, DBLP, and Laion datasets at 𝑆𝑒𝑙 (𝑠𝑞 ) ≈ 0.3. We further evaluate low-selectivity queries with 𝑆𝑒𝑙 (𝑠𝑞 ) ≈ 0.01 and 0.05 on SIFT and DBLP datasets. At moderate selectivities, ComSURF achieves higher QPS than the baselines at comparable recall. Compared with the state-ofthe-art VectorMaton, at selectivity 0.2, ComSURF achieves 1.16– 1.99× higher QPS at 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.95 across all eight datasets; at 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.99, ComSURF achieves 1.14–1.43× higher QPS on SIFT, Redcaps, arXiv, Deep, and DBLP, while the two methods perform comparably on GIST. At selectivity 0.3, ComSURF achieves 1.10–1.76× higher QPS at 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.95, and remains 1.28–1.38× faster at 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.99 on the three datasets where both methods reach this recall level. Moreover, ComSURF achieves higher maximum recall on several datasets where VectorMaton cannot reach 0.99, particularly Laion and IMDB. Compared with the other baselines, at 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.99 and selectivity 0.2, ComSURF achieves 3.2–13.5× higher QPS than Post-filtering, 2.4–9.9× than SURF, 20.5–53.1× than ACORN-1, and 11.0–45.5× than ACORN-𝛾. The improvement over Milvus is even larger. Similar advantages are observed at selectivity 0.3. The performance improvement of ComSURF over SURF comes from both index compression and adaptive query processing. ComSURF combines pre-filtering for small candidate sets, post-filtering with retained ancestor graphs for skipped states, and dedicated graph search for other states. The comparison is also affected by memory constraints. The fully uncompressed SURF index causes out-of-memory failures on many datasets when 𝑒 𝑓min = 0. We therefore set 𝑒 𝑓min = 2, 000 to make index construction feasible, requiring exact scans for states with at most 2,000 candidates. This constraint further degrades query performance by replacing graph search with potentially more expensive distance computations. At low selectivities, ComSURF continues to demonstrate strong performance. Compared with VectorMaton, ComSURF achieves 1.25–1.59× higher QPS at 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.95 under selectivity 0.01, and 1.22–1.38× under selectivity 0.05. At 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.99, it achieves 1.13–1.34× higher QPS than VectorMaton across the two datasets and both selectivities. Compared with the other baselines, at 𝑟𝑒𝑐𝑎𝑙𝑙@10 ≥ 0.95, ComSURF achieves 2.1–15.2× higher QPS than SURF and up to 100.5× and 149.8× higher QPS than Postfiltering and Pre-filtering, respectively. Compared with moderate selectivities, Post-filtering degrades substantially because fewer traversed vertices satisfy the filter, resulting in more wasted exploration. Pre-filtering becomes relatively more competitive as the candidate sets shrink, but remains considerably slower than ComSURF.
17.70 21.61 27.98 18.83 8.75 41.64 65.89 53.12
5.33 7.48 7.96 6.79 1.48 8.43 12.76 11.84
15.05 18.38 24.60 15.56 4.98 28.80 38.79 21.09
Milvus SIFT (_)
QPS
416 2,647 1,300 964 271 2,521 4,335 3,914
10
4
10
3
10
2
10
1
10
0
0.90
0.95 1.00 Recall@10
VBASE
0.91 4.01 2.34 1.39 0.52 2.34 3.29 4.25 VectorMaton
SIFT (_ and %)
1.40 4.67 2.82 1.87 0.73 2.88 3.78 4.74
0.73 3.71 2.05 1.20 0.47 2.05 3.12 4.07
ComSURF
DBLP (_)
DBLP (_ and %)
10
4
3
10
10
10
3
3
10
10
2
2
2
10
10
10
1
10
1
1
10
0
10
0
10
0
0.90
0.95 1.00 Recall@10
0.90
2.12 4.80 2.80 2.63 0.76 3.76 6.20 6.36
0.95 1.00 Recall@10
0.90
0.95 1.00 Recall@10
Figure 7: Search performance with LIKE predicates (Exp. 3) Exp. 2: Indexing Cost. Tables 2 and 3 report the index construction time (in seconds) and index size (in GB), respectively. Milvus, VBASE, and Post-filtering rely on the same underlying HNSW index; therefore, we report their indexing costs using the HNSW results. Compared with the state-of-the-art VectorMaton, ComSURF achieves 2.28–5.70× faster index construction and 1.78– 3.42× smaller index size across all eight datasets. Compared with the original SURF, ComSURF further reduces construction time by 2.23–6.43× and index size by 2.77–5.91×, demonstrating the effectiveness of our compression rules. Together with the superior search performance observed in Exp. 1, these results demonstrate that ComSURF achieves both efficient index construction and query processing. While ACORN and OneSparse require smaller index space and construction time, their search performance is substantially worse than SURF/ComSURF, as shown in Exp. 1. Exp. 3: Search Performance with LIKE Predicates. We evaluate vector searches on SIFT and DBLP using two query workloads: (1) patterns with only _, and (2) patterns with both _ and %. Queries are generated by injecting wildcards into substring predicates while keeping the selectivity at approximately 0.2. We compare ComSURF against two native LIKE baselines, Milvus [34] and VBASE [48], and VectorMaton, whose wildcard support is limited to _. We set 𝑘 = 10 and report the search performance in Fig. 7. Since the indexes from Exp. 2 are reused, we omit index costs. Across both datasets, ComSURF outperforms Milvus and VBASE by two to three orders of magnitude in QPS at comparable recall. For the _-only workload, ComSURF also achieves over an order of magnitude higher QPS than VectorMaton. This advantage stems from our link-tree-based pruning, which avoids exploring redundant branches induced by wildcards. In contrast, VectorMaton explores all outgoing automaton transitions upon encountering _, incurring additional overhead. Meanwhile, Milvus and VBASE evaluate LIKE predicates during ANN search on a global index, resulting in costly traversal and predicate evaluation over non-qualifying vectors. Exp. 4: Index Maintenance. Following [38], we first build an index on 80% of the data, then insert the remaining 20%, followed by deleting 20% of the indexed data. We report the average insertion and deletion times in Fig. 8(a), and compare the search performance before and after index maintenance in Fig. 8(b). ComSURF achieves
SURF: Substring Filtered Approximate Nearest Neighbor Search
0
3
QPS (×10 )
20
60 40 20 0
SIFT
DBLP
SIFT
8 6 4 2 0 0.90
0.95
1.00
2.5 2 1.5 1 0.5 0 0.90
0.95
Recall@10
DBLP
(a) Average update time
VectorMaton (After) ComSURF (After) DBLP
3
Deletion Average Time (μs)
Average Time (ms)
40
VectorMaton (Before) ComSURF (Before) SIFT
ComSURF
80
QPS (×10 )
VectorMaton Insertion 60
1.00
Recall@10
(b) Search performance before and after updates
Figure 8: Index maintenance performance (Exp. 4) Table 4: The effects of 𝛼 and 𝑒 𝑓min on index cost (Exp. 5) 0.3 0.3 0.3 0.3 0.1 0.5 0.7 1 0 100 200 500 200 200 200 200 7.67 5.55 5.33 5.05 4.23 5.76 5.99 6.20 519 499 416 408 389 429 438 457 16.72 13.16 12.76 12.23 10.55 14.03 14.57 15.42 4,564 4,351 4,335 4,025 3,291 4,738 4,960 5,422
𝛼 𝑒 𝑓min SIFT Index Size (GB) SIFT Build Time (s) DBLP Index Size (GB) DBLP Build Time (s)
α = 0.3, efmin = 0 α = 0.1, efmin = 200
8
α = 0.3, efmin = 200 α = 0.7, efmin = 200
4 2 0 0.90
0.95
α = 0.3, efmin = 500 α = 1, efmin = 200
DBLP (Sel = 20%)
3
6
QPS (×103 )
QPS (×103 )
α = 0.3, efmin = 100 α = 0.5, efmin = 200
SIFT (Sel = 20%)
1 0 0.90
1.00
9
2
0.95
Recall@10
1.00
Recall@10
Figure 9: The effects of 𝛼 and 𝑒 𝑓min on search (Exp. 5)
3
6 4 2 0 0.90
0.95 1.00 Recall@10
Deep 10
4
10
3
10
2
k = 20
k = 50
SIFT
4 3 2
k = 100 DBLP
QPS
8
k = 10
Uniform 5
QPS (×10 )
3
QPS (×10 )
Poisson
SIFT
QPS
Multi 10
10
3
10
2
10
1
1 0 0.90
0.95 1.00 Recall@10
0.90
0.95 1.00 Recall@k
0.90
SIFT and Deep as examples, with query selectivity fixed at 0.2. We additionally generate base-string attributes under three distributions: Multinomial, Poisson, and Uniform, while generating query predicates using the same procedure described in Datasets. Fig. 10 reports the QPS-𝑟𝑒𝑐𝑎𝑙𝑙@10 curves. ComSURF performance is stable across different distributions, and skewed distributions, Zipf and Multinomial, are slightly easier for all methods because frequently repeated substrings induce denser filtered neighbors. Exp. 7: Vary 𝑘. We evaluate the impact of 𝑘 ∈ {10, 20, 50, 100} on the search performance of ComSURF, with selectivity fixed at 0.2. As shown in Fig. 11, search performance gradually decreases as 𝑘 increases on both SIFT and DBLP, since retrieving more nearest neighbors requires examining and maintaining more candidates to achieve comparable recall. Nevertheless, the performance gap becomes smaller at high recall levels.
0.95 1.00 Recall@k
Figure 10: Varying string at- Figure 11: Varying obtained tribute distributions (Exp. 6) number of results 𝑘 (Exp. 7) faster insertion than VectorMaton, benefiting from our efficient index construction techniques. However, its deletion is slower due to our periodic index reconstruction strategy, whereas VectorMaton adopts only lazy deletion. Despite this additional maintenance cost, ComSURF largely preserves its search performance after updates, while VectorMaton exhibits noticeable performance degradation. Exp. 5: Effects of Parameters 𝛼 and 𝑒 𝑓min . We evaluate the effects of 𝛼 and 𝑒 𝑓min on search performance and index cost. Setting 𝑒 𝑓min = 0 disables prefiltering, while 𝛼 = 1 restricts ancestor serving to states with identical candidate-set sizes. As shown in Table 4, increasing 𝑒 𝑓min reduces index size and building time, but may affect search performance. On SIFT, search performance slightly degrades when 𝑒 𝑓min increases from 200 to 500, whereas on DBLP, it remains nearly unchanged. This suggests that dataset-specific tuning of 𝑒 𝑓min can further improve the tradeoff between search performance and index cost. For 𝛼, larger values generally improve search performance by reducing postfiltering overhead, at the expense of higher index size and construction time. These results demonstrate the potential benefits of parameter tuning, which we leave for future work to automate. Exp. 6: Varying Synthetic Attribute Distributions. We study the impact of synthetic string distributions on performance using
Conclusion
In this paper, we propose SURF/ComSURF for substring filtered ANN search. We first design MultiSA, a provably minimal suffix automaton for organizing substring-equivalent object sets, and integrate it with proximity graphs to avoid redundant traversal over non-qualifying objects. We further develop efficient index compression techniques and extend our approach to support LIKE predicates with two wildcards. Extensive experiments on 8 realworld datasets demonstrate the effectiveness and efficiency of our approach. ComSURF consistently achieves superior search performance over existing baselines across different query selectivities. Compared with the state-of-the-art approach, VectorMaton, ComSURF achieves 1.78–3.42× smaller index size and 2.28–5.70× faster index building, while delivering better search performance.
References [1] 2010. Datasets for approximate nearest neighbor search. http://corpus-texmex. irisa.fr/. [2] 2026. DBLP XML Data Dumps. https://dblp.org/xml/. [3] 2026. IMDb Non-Commercial Datasets. https://developer.imdb.com/noncommercial-datasets/. [4] Ilias Azizi, Karima Echihabi, and Themis Palpanas. 2023. Elpis: Graph-Based Similarity Search for Scalable Data Science. Proc. VLDB Endow. 16, 6 (2023), 1548–1559. [5] Belinda Zeng. 2022. Go beyond the search box: Introducing multisearch. https: //blog.google/products-and-platforms/products/search/multisearch/ [6] Thierry Bertin-Mahieux, Daniel P. W. Ellis, Brian Whitman, and Paul Lamere. 2011. The Million Song Dataset. In Proceedings of the 12th International Society for Music Information Retrieval Conference, ISMIR 2011. University of Miami, 591–596. [7] Anselm Blumer, J. Blumer, Andrzej Ehrenfeucht, David Haussler, and Ross M. McConnell. 1983. Linear size finite automata for the set of all subwords of a word - an outline of results. Bull. EATCS 21 (1983), 12–20. [8] Anselm Blumer, J. Blumer, David Haussler, Andrzej Ehrenfeucht, M. T. Chen, and Joel I. Seiferas. 1985. The Smallest Automaton Recognizing the Subwords of a Text. Theor. Comput. Sci. 40 (1985), 31–55. [9] Yuzheng Cai, Jiayang Shi, Yizhuo Chen, and Weiguo Zheng. 2024. Navigating Labels and Vectors: A Unified Approach to Filtered Approximate Nearest Neighbor Search. Proc. ACM Manag. Data 2, 6 (2024), 246:1–246:27. [10] Yaoqi Chen, Ruicheng Zheng, Qi Chen, Shuotao Xu, Qianxi Zhang, Xue Wu, Weihao Han, Hua Yuan, Mingqin Li, Yujing Wang, Jason Li, Fan Yang, Hao Sun, Weiwei Deng, Feng Sun, Qi Zhang, and Mao Yang. 2024. OneSparse: A Unified System for Multi-index Vector Search. In WWW. ACM, 393–402. [11] Hugo Dalla-Torre, Liam Gonzalez, Javier Mendoza-Revilla, Nicolas Lopez Carranza, Adam Henryk Grzywaczewski, Francesco Oteri, Christian Dallago, Evan Trop, Bernardo P. de Almeida, Hassan Sirelkhatim, Guillaume Richard, Marcin Skwark, Karim Beguir, Marie Lopez, and Thomas Pierrot. 2025. Nucleotide Transformer: building and evaluating robust foundation models for human genomics. Nature Methods 22, 2 (2025), 287–297.
Jiadong Xie, Hao Jiang, Yingfan Liu, Jeffrey Xu Yu, Hui Li, and Jiangtao Cui
[12] Yangshen Deng, Zhengxin You, Long Xiang, Qilong Li, Peiqi Yuan, Zhaoyang Hong, Yitao Zheng, Wanting Li, Runzhong Li, Haotian Liu, Kyriakos Mouratidis, Man Lung Yiu, Huan Li, Qiaomu Shen, Rui Mao, and Bo Tang. 2025. AlayaDB: The Data Foundation for Efficient and Effective Long-context LLM Inference. CoRR abs/2504.10326 (2025). [13] Karan Desai, Gaurav Kaul, Zubin Aysola, and Justin Johnson. 2021. RedCaps: Web-curated image-text data created by the people, for the people. In Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks 1, NeurIPS Datasets and Benchmarks 2021. [14] 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. [15] Jianyang Gao and Cheng Long. 2023. High-Dimensional Approximate Nearest Neighbor Search: with Reliable and Efficient Distance Comparison Operations. Proc. ACM Manag. Data 1, 2 (2023), 137:1–137:27. [16] Luyu Gao, Zhuyun Dai, and Jamie Callan. 2021. COIL: Revisit Exact Lexical Match in Information Retrieval with Contextualized Inverted List. In NAACLHLT. Association for Computational Linguistics, 3030–3042. [17] Ben Harwood and Tom Drummond. 2016. FANNG: Fast Approximate Nearest Neighbour Graphs. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016. IEEE Computer Society, 5713–5722. [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] Zhonggen Li, Yougen Li, Yifan Zhu, Zhaoqiang Chen, and Yunjun Gao. 2025. Allin-one Graph-based Indexing for Hybrid Search on GPUs. CoRR abs/2511.00855 (2025). [20] Zhuofeng Li, Haoxiang Zhang, Cong Wei, Pan Lu, Ping Nie, Yi Lu, Yuyang Bai, Shangbin Feng, Hangxiao Zhu, Ming Zhong, Yuyu Zhang, Jianwen Xie, Yejin Choi, James Zou, Jiawei Han, Wenhu Chen, Jimmy Lin, Dongfu Jiang, and Yu Zhang. 2026. Beyond Semantic Similarity: Rethinking Retrieval for Agentic Search via Direct Corpus Interaction. CoRR abs/2605.05242 (2026). [21] Shige Liu, Zhifang Zeng, Li Chen, Adil Ainihaer, Arun Ramasami, Songting Chen, Yu Xu, Mingxi Wu, and Jianguo Wang. 2025. TigerVector: Supporting Vector Search in Graph Databases for Advanced RAGs. CoRR abs/2501.11216 (2025). [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] Malteos. 2022. Aspect Paper Embeddings. https://huggingface.co/datasets/ malteos/aspect-paper-embeddings. [24] Tomás Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. 2013. Distributed Representations of Words and Phrases and their Compositionality. In 27th Annual Conference on Neural Information Processing Systems 2013. 3111–3119. [25] Nasser M Nasrabadi and Robert A King. 1988. Image coding using vector quantization: A review. IEEE Transactions on communications 36, 8 (1988), 957–971. [26] James Jie Pan, Jianguo Wang, and Guoliang Li. 2024. Survey of vector database management systems. VLDB J. 33, 5 (2024), 1591–1615. [27] Liana Patel, Peter Kraft, Carlos Guestrin, and Matei Zaharia. 2024. ACORN: Performant and Predicate-Agnostic Search Over Vector Embeddings and Structured Data. Proc. ACM Manag. Data 2, 3 (2024), 120. [28] 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. [29] Benjarath Phoophakdee and Mohammed J. Zaki. 2007. Genome-scale disk-based suffix tree indexing. In Proceedings of the ACM SIGMOD International Conference on Management of Data, Beijing, China, June 12-14, 2007. ACM, 833–844. [30] Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. 2021. LAION-400M: Open Dataset of CLIP-filtered 400 Million Image-text Pairs. CoRR abs/2111.02114 (2021). [31] Sahil Sen, Akhil Kasturi, Elias Lumer, Anmol Gulati, and Vamse Kumar Subbiah.
2026. Is Grep All You Need? How Agent Harnesses Reshape Agentic Search. CoRR abs/2605.15184 (2026). [32] Amanpreet Singh, Mike D’Arcy, Arman Cohan, Doug Downey, and Sergey Feldman. 2022. SciRepEval: A Multi-Format Benchmark for Scientific Document Representations. In Conference on Empirical Methods in Natural Language Processing. https://api.semanticscholar.org/CorpusID:254018137 [33] Aditi Singh, Suhas Jayaram Subramanya, Ravishankar Krishnaswamy, and Harsha Vardhan Simhadri. 2021. FreshDiskANN: A Fast and Accurate Graph-Based ANN Index for Streaming Similarity Search. CoRR abs/2105.09613 (2021). [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] Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, and Furu Wei. 2022. Text Embeddings by Weakly-Supervised Contrastive Pre-training. arXiv:2212.03533 [cs.CL] doi:10.48550/arXiv.2212.03533 [36] 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. [37] Chuangxian Wei, Bin Wu, Sheng Wang, Renjie Lou, Chaoqun Zhan, Feifei Li, and Yuanzhe Cai. 2020. AnalyticDB-V: A Hybrid Analytical Engine Towards Query Fusion for Structured and Unstructured Data. Proc. VLDB Endow. 13, 12 (2020), 3152–3165. [38] Haoxuan Xie and Siqiang Luo. 2026. VectorMaton: Efficient Vector Search with Pattern Constraints via an Enhanced Suffix Automaton. CoRR abs/2603.01525 (2026). [39] Jiadong Xie, Jeffrey Xu Yu, and Yingfan Liu. 2025. Fast Approximate Similarity Join in Vector Databases. Proc. ACM Manag. Data 3, 3 (2025), 158:1–158:26. [40] 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. [41] Jiadong Xie, Jeffrey Xu Yu, Siyi Teng, and Yingfan Liu. 2025. Beyond Vector Search: Querying With and Without Predicates. Proc. ACM Manag. Data 3, 6 (2025), 300:1–300:26. [42] Yuexuan Xu, Jianyang Gao, Yutong Gou, Cheng Long, and Christian S. Jensen. 2024. iRangeGraph: Improvising Range-dedicated Graphs for Range-filtering Nearest Neighbor Search. Proc. ACM Manag. Data 2, 6 (2024), 239:1–239:26. [43] Mingyu Yang, Wentao Li, Jiabao Jin, Xiaoyao Zhong, Xiangyu Wang, Zhitao Shen, Wei Jia, and Wei Wang. 2025. Effective and General Distance Computation for Approximate Nearest Neighbor Search. In ICDE. IEEE, 1098–1110. [44] Song Yu, Shengyuan Lin, Shufeng Gong, Yongqing Xie, Ruicheng Liu, Yijie Zhou, Ji Sun, Yanfeng Zhang, Guoliang Li, and Ge Yu. 2025. A Topology-Aware Localized Update Strategy for Graph-Based ANN Index. CoRR abs/2503.00402 (2025). [45] Chaoqun Zhan, Maomeng Su, Chuangxian Wei, Xiaoqiang Peng, Liang Lin, Sheng Wang, Zhe Chen, Feifei Li, Yue Pan, Fang Zheng, and Chengliang Chai. 2019. AnalyticDB: Real-time OLAP Database System at Alibaba Cloud. Proc. VLDB Endow. 12, 12 (2019), 2059–2070. [46] Yirui Zhan, Wen Nie, and Jun Gao. 2025. SSCard: Substring Cardinality Estimation using Suffix Tree-Guided Learned FM-Index. Proc. ACM Manag. Data 3, 4 (2025), 265:1–265:24. [47] Haoyu Zhang, Jun Liu, Zhenhua Zhu, Shulin Zeng, Maojia Sheng, Tao Yang, Guohao Dai, and Yu Wang. 2024. Efficient and Effective Retrieval of Dense-Sparse Hybrid Vectors using Graph-based Approximate Nearest Neighbor Search. CoRR abs/2410.20381 (2024). [48] 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. [49] Chaoji Zuo, Miao Qiao, Wenchao Zhou, Feifei Li, and Dong Deng. 2024. SeRF: Segment Graph for Range-Filtering Approximate Nearest Neighbor Search. Proc. ACM Manag. Data 2, 1 (2024), 69:1–69:26.
Related documents
- Nearly-Optimal Dynamic Subtree Mode#1802076
- CAD-from-Code: A Programmatic Data Engine for CAD Synthesis and Deterministic Evaluation#1802077
- From Code Changes to Slowdowns: An Empirical Study of Performance Regressions in Open-Source Database Kernels#1802079
- Reliable Agentic Data Systems: Challenges, Principles, and a Research Agenda#1802080
- Tournament on Path: Global Relation Abstraction and Pair-wise Ranking for Knowledge Graph Reasoning#1802081
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive