What is the descend-to-insertion-level step?

The descend-to-insertion-level step is the phase of a nodes insertion that greedily descends through every layer above the new nodes maximum layer, purely to find a good starting position for where its own connections will begin forming.
Created: Updated: 4 min read

The descend-to-insertion-level step is the phase of a node’s insertion that runs immediately after level sampling has determined the new node’s maximum layer — a greedy descent through every layer of the hierarchy that sits above that maximum, purely to find a good starting position for the layer where the new node’s own connections will actually begin forming. It’s the bridge between “the new node has been assigned a layer” and “the new node is actually being connected to the graph,” and understanding its purpose clarifies why insertion needs two visibly different search behaviors chained together rather than one uniform process from top to bottom.

Why does insertion need this descent phase at all, rather than jumping straight to the new node’s own maximum layer?

The new node doesn’t exist anywhere in the graph yet, and the only way to find where it should eventually connect is to actually navigate the existing structure toward its position in the vector space. If the new node’s maximum layer happens to be lower than the current entry point’s layer — which is true for the large majority of insertions, since high layers are rare by design — then there’s a stretch of upper layers where the new node has no presence at all, but where a search still needs to travel through in order to reach the layer where the new node’s participation actually begins. The descend-to-insertion-level step handles exactly this stretch: starting from the global entry point, it performs a simple greedy descent through each of these upper layers, using each layer’s own connections to move progressively closer to the new node’s actual position, until it reaches the specific layer equal to the new node’s own maximum, at which point construction search and neighbor selection take over.

This descent uses the same lightweight, single-best-candidate greedy strategy described on the greedy-navigation glossary page — at each layer, move to whichever neighbor looks closest to the new vector, and once no neighbor offers further improvement, drop down to the next layer and repeat. No connections get formed anywhere during this phase, since the new node isn’t actually present in any of these upper layers; the phase exists purely to locate a good position to hand off to the deeper, connection-forming part of insertion.

Mechanically, the descend-to-insertion-level step and the upper-layer portion of a query-time search are doing exactly the same thing: starting from the global entry point and greedily descending through successive layers to find a good position relative to some target vector. The only difference is what that target vector represents and what happens once the descent finishes — a query’s descent is aimed at the query vector and hands off to the base-layer search that will produce the final returned results, while insertion’s descent is aimed at the new vector being inserted and hands off to the construction-search-and-neighbor-selection process that will actually integrate that vector into the graph. This shared mechanism is a specific instance of the broader point made on the SEARCH-LAYER-algorithm glossary page: much of what looks like separate machinery for “searching” and “inserting” is really the same underlying routines, applied to slightly different purposes.

What happens differently if the new node’s maximum layer turns out to be higher than the current entry point’s layer instead?

In the comparatively rare event that level sampling assigns the new node a maximum layer taller than any layer currently present in the graph, there’s no descent to perform above the new node’s own maximum, since no such layers yet exist — the new node’s insertion begins connection-forming immediately at its own top layer, and, once insertion completes, this new node becomes the graph’s new entry point, exactly as described on the entry-point-in-HNSW glossary page. This edge case is worth being aware of specifically because it shows the descend-to-insertion-level step isn’t a fixed, mandatory stretch of work every insertion performs identically — its length depends entirely on the gap between the new node’s randomly assigned maximum layer and whatever the current entry point’s layer happens to be at that specific moment, and that gap can, on rare occasions, be zero or even undefined in the sense that no descent is needed at all.

Having covered how the descend-to-insertion-level step bridges level sampling and the connection-forming part of insertion, the HNSW-insertion-algorithm and greedy-navigation glossary pages are worth revisiting together with this fuller picture of exactly where this phase fits within the larger sequence. From there, the construction-search-in-HNSW glossary page picks up immediately where this step leaves off, covering what happens once the descent has reached the layer where the new node’s actual connections begin forming.