Papers
Topics
Authors
Recent
Search
2000 character limit reached

Dual-Branch HNSW++ for Efficient ANN Search

Updated 10 February 2026
  • The paper introduces Dual-Branch HNSW++ that enhances traditional HNSW through a dual-branch graph, LID-driven node insertion, and skip-bridge techniques to reduce local optima.
  • It demonstrates significant performance gains with up to +30% recall improvement and 18-20% build time reduction, while maintaining comparable query speed across varied datasets.
  • The methodology leverages parallel branch searches and effective merging strategies, ensuring robust connectivity and efficient handling of high-dimensional data.

The Dual-Branch HNSW++ algorithm is an enhanced approach for Approximate Nearest Neighbor (ANN) search that addresses key limitations of the original Hierarchical Navigable Small World (HNSW) method. By integrating a dual-branch architecture, Local Intrinsic Dimensionality (LID)–driven node insertion, and a skip-bridge mechanism, Dual-Branch HNSW++ improves accuracy, connectivity, and construction efficiency without compromising query speed. Extensive benchmarking demonstrates consistent gains in recall, construction time, and high-dimensional robustness across both computer vision and natural language processing datasets (Nguyen et al., 23 Jan 2025).

1. Limitations of Traditional HNSW and Rationale for HNSW++

The canonical HNSW algorithm constructs multi-layer small-world graphs by greedily linking each new data point to the closest neighbors found at each layer, descending from sparser higher layers to a dense base layer. This local search is prone to suboptimal neighbor selection, leading to:

  • Local Optima: Search trajectories may become trapped in clusters (basins of attraction) disconnected from true nearest neighbors, reducing recall.
  • Logarithmic Complexity Degradation: In high-dimensional settings, theoretical O(nlogn)\mathcal O(n\log n) scaling is undermined by exhaustive, layer-by-layer traversals, yielding a large constant factor in computational cost.

Dual-Branch HNSW++ introduces key modifications to reduce local-optimum risk, improve outlier and inter-cluster connectivity, and reduce per-query and per-insertion search space (Nguyen et al., 23 Jan 2025).

2. Dual-Branch Graph Structure

Dual-Branch HNSW++ partitions the dataset DD (size nn) into two interleaved branches, denoted branch 0 and branch 1. This assignment is alternated during the layer-assignment process. Each branch forms an independent multi-layer HNSW graph, with node layers indexed 0,1,,Lmax0,1,\dots,L_{\max}.

During querying, greedy search is conducted independently in both branches. Each query qq is initialized at the top layer entry point in both branch 0 and branch 1. The two searches proceed in parallel, descending layers until reaching the base (layer 0), or skipping directly to layer 0 if a suitable skip-bridge is traversed (see Section 4). At layer 0, the neighbor sets W0W_0 and W1W_1 from both branches are merged (excluding duplicates) to yield the final top-kk result.

Dual-Branch Search (Abridged Pseudocode):

1
2
3
4
5
6
7
8
9
10
11
12
13
function DUAL_BRANCH_SEARCH(hnsw, q, k):
    ep0  highestlevel entry in branch_0
    ep1  highestlevel entry in branch_1
    W0, W1  {ep0}, {ep1}
    L0, L1  top_layer(branch_0), top_layer(branch_1)
    while L0  0 or L1  0:
        if L0  0:
            (W0, skip0)  SEARCH_LAYER(q, W0, L0, lid_threshold)
            L0  0 if skip0 else (L0  1)
        if L1  0:
            (W1, skip1)  SEARCH_LAYER(q, W1, L1, lid_threshold)
            L1  0 if skip1 else (L1  1)
    return MERGE(W0, W1, k)
Node assignment, graph building, and searches are conducted independently for each branch, reducing the active graph size per operation by half. Merging ensures coverage of disjoint clusters and supports diversity in search paths.

3. LID-Driven Layer Assignment and Insertion

Local Intrinsic Dimensionality (LID) quantifies the local space’s effective dimensionality around each data point. For point xx, LID is estimated as

LID(x)=(1k1i=1k1logdk(x)di(x))1,di(x)=xx(i)2LID(x) = \left( \frac{1}{k-1} \sum_{i=1}^{k-1}\log \frac{d_k(x)}{d_i(x)} \right)^{-1}, \qquad d_i(x) = \|x - x_{(i)}\|_2

where x(i)x_{(i)} is the iith-nearest neighbor of xx.

The algorithm proceeds as follows:

  • Compute LID for all nodes via kk-NN.
  • Normalize LID to [0,1][0, 1]:

LID~(x)=LID(x)minLIDmaxLIDminLID\widetilde{LID}(x) = \frac{LID(x) - \min LID}{\max LID - \min LID}

  • Sort nodes in descending normalized LID order. Assignment alternates between the two branches.
  • Layer assignment samples levels with probability favoring higher layers for higher LID points:

=max(0,min(log(u)mL,Lmax)),uUniform(0,1)\ell = \max\left(0, \min(\lfloor -\log(u) m_L \rfloor, L_{\max})\right), \quad u \sim \text{Uniform}(0,1)

High-LID points are thus inserted as long-range connectors (“hubs”), promoting connectivity and mitigating cluster disconnections.

4. Skip Bridges: Bridge-Building for Efficient Layer Traversal

The skip-bridge or bridge-building technique enables the search process to bypass intermediate layers when certain geometric and structural conditions are met. Specifically, at layer LL_\ell, the search descends directly to layer $0$ (the base) if

LID(ep)>Td(ep,q)<εLID(\text{ep}) > T \wedge d(\text{ep},q) < \varepsilon

where TT is a hyperparameter LID threshold and ε\varepsilon is a distance threshold. If both are satisfied for the current entry point ep and query qq, the search jumps immediately to the base layer. This reduces unnecessary traversals through sparse or redundant layers, shaving overhead introduced by dual-branching and accelerating queries in practice.

5. Computational Complexity

The dual-branch design influences all dimensions of complexity:

  • Search Complexity: Each branch contains  ⁣n/2\approx\!n/2 nodes. Standard HNSW query cost is O(logn)\mathcal O(\log n). Skip bridges reduce the expected number of layer traversals to Ltot(1Pskip)L_{\mathrm{tot}} \cdot (1 - P_{\mathrm{skip}}), with PskipP_{\mathrm{skip}} the probability of skip conditions being met. Merging two small sets at layer 0 is O(k)\mathcal O(k). Overall, query complexity remains O(logn)\mathcal O(\log n) but with a reduced constant.
  • Construction Complexity: LID computation for all nodes is O(nlogn)\mathcal O(n\log n) due to kk-NN. Each insertion is O(logn)\mathcal O(\log n) per branch, yielding total build time O(nlogn)\mathcal O(n\log n). The per-insertion search space is halved.
  • Space Complexity: The two-branch architecture retains total memory complexity O(nM)\mathcal O(nM) (with each node having up to MM links per layer), identical to original HNSW.

6. Empirical Evaluation and Component Analysis

Experiments covered six datasets: three from computer vision (SIFT $128$-d, GIST $960$-d, DEEP $96$-d), one from NLP (GloVe $100$-d), and two synthetic. Each dataset included $10,000$ points for index construction and $1,000$ queries, measured by recall@10, build time, and query latency using L2L_2-distance.

Key results demonstrate that Dual-Branch HNSW++ provides:

Dataset Recall@10 Improvement Build Time Reduction
SIFT (CV) +28% –18%
GIST (CV) +30% –20%
DEEP (CV) +25% –17%
GLOVE (NLP) +18% –12%
  • Query latency is unchanged (±2%\pm 2\%) or slightly reduced.
  • No empirical trade-off observed between recall and speed.

Ablation studies indicate:

  • LID-based insertion yields the largest single-factor gain in recall (+12–14 percentage points).
  • Dual-branching adds a further gain of +8–10 points.
  • Skip bridges reduce query time by ~10–15% without recall degradation.

7. Comparative Performance with State-of-the-Art ANN Methods

In benchmarking (for example, on GIST 960-dimensional), Dual-Branch HNSW++ shows the following results:

Method Recall@10 Query QPS Build Time (s)
FAISS IVFPQ 0.65 5k 18
Annoy 0.58 7k 22
NMSLIB (HNSW) 0.78 12k 15
HNSW++ 0.92 12.4k 12

Dual-Branch HNSW++ thus outperforms both graph-based (NMSLIB) and tree/quantization-based (FAISS, Annoy) methods in recall, accelerates build time, and maintains or exceeds query throughput. Observed gains are attributed to improved graph connectivity, rapid outlier capture, and efficient traversal enabled by LID-driven hubs and bridges. There are no observed trade-offs; recall increases as build time decreases, with query speed unaltered (Nguyen et al., 23 Jan 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Dual-Branch HNSW++.