apache / apache/lucene

Search old graphs during HNSW merging new graph building

Open
#15,504 2 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

When merging HNSW indexed segments, we attempt to improve the incremental nature of HNSW's indexing algorithm by re-using already calculated statistics.

This includes:

- Utilizing the biggest graph (after repairing deletes)
- Optimizing the entry points for smaller graph merging (MergingHnswGraphBuilder)

However, we still ultimately do incremental building of the graph. I think another good optimization would be to reuse the previously calculated graphs to further augment our bulk building of HNSW graphs.

The idea is as follows. When gathering the potential connections for a given node, instead of only searching the NEW graph (or the largest one), every graph is searched directly.

This is means:
- Nodes no longer need to worry about backlinks as ALL nodes were considered on indexing
- It makes parallel building even faster as backlinks aren't required and all existing graphs can be searched in parallel

This idea should be applicable even to the `MergingHnswGraphBuilder`.

Contributor guide

Open the contributing guide

Research direction

Start by reading the HNSW segment-merging implementation, especially MergingHnswGraphBuilder, and trace how potential connections are gathered from the new or largest graph. Compare that flow with searching every existing graph directly. Done means the proposed reuse of existing graphs works during HNSW merging without relying on backlinks and is validated by the project's relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.