What is the maximum layer of a node?
The maximum layer of a node is the single number, decided randomly when that node is first inserted, that determines every layer it will ever participate in — a node with a maximum layer of three exists in the base layer and in layers one, two, and three as well, while a node with a maximum layer of zero exists only in the base layer and nowhere else. It’s the outcome of the random layer-assignment process governed by the level-multiplier parameter mL, and it’s the single piece of information that fully determines a given node’s place within the entire HNSW hierarchy.
How does this one number end up determining participation across multiple layers at once?
A node’s maximum layer isn’t a description of a single specific layer it belongs to — it’s the ceiling of a contiguous range starting at zero. Once the random layer-assignment process determines that ceiling for a newly inserted node, the node gets placed in every layer from zero up through that maximum, with no gaps and no exceptions. This is why a node with a maximum layer of three necessarily also appears in layers zero, one, and two — there’s no way for a node to skip an intermediate layer and appear only in some higher one while being absent from the layers beneath it, since the assignment process determines the full extent of a contiguous range rather than picking out individual layers independently.
This nesting structure is part of what keeps the hierarchy coherent as a connected system rather than a collection of unrelated graphs stacked arbitrarily on top of each other — because every node present at a given layer is guaranteed to also be present at every layer below it, a search descending from a high layer to a lower one always finds its current best node still present and ready to serve as the starting point for the next layer’s search, with no risk of the search’s current position simply vanishing partway through the descent.
Why does the random process behind this assignment favor low maximum layers so heavily?
The probability distribution used to draw a node’s maximum layer is deliberately skewed to make low values overwhelmingly common and high values increasingly rare, with the steepness of that skew controlled by mL. This is exactly what produces the hierarchy’s characteristic narrowing shape — since the overwhelming majority of nodes end up with a maximum layer of zero, the base layer ends up containing essentially the entire dataset, while progressively fewer nodes reach layer one, fewer still reach layer two, and so on. A node reaching an unusually high maximum layer is, by design, a comparatively rare event, which is exactly what keeps the upper layers sparse enough to provide the long-range navigational shortcuts the whole hierarchy depends on.
Because this assignment happens independently for every node at the moment of its own insertion, with no coordination between different nodes’ assignments and no adjustment based on where a node actually sits in the vector space, which specific vectors end up reaching high maximum layers is essentially arbitrary from a geometric standpoint — a node’s semantic content or position in the embedding space has no bearing on how high its randomly assigned maximum layer turns out to be. The hierarchy’s structure comes entirely from the statistical shape of this random process applied across many insertions, not from any deliberate curation of which specific vectors deserve to serve as long-range hubs.
Does a node’s maximum layer, once assigned, ever change over the life of an index?
No — a node’s maximum layer is determined once, at the moment of its insertion, and stays fixed for as long as that node remains in the index. What can change, as discussed on the neighbor-list-overflow glossary page, is which specific neighbors a node connects to within the layers it already participates in, since later insertions can trigger pruning that adjusts a node’s connections even well after its own initial insertion is complete. But the set of layers a node belongs to in the first place — determined entirely by its maximum layer — is a permanent property assigned once and never revisited, unless the node itself is deleted and, in some implementations, later reinserted through an entirely separate process with its own fresh random assignment.
Having covered exactly what a node’s maximum layer determines and how the random process behind it produces the hierarchy’s characteristic shape, the level-assignment-probability and mL glossary pages are the natural next stop, since they cover the specific mechanics of the random process this page describes the outcome of. From there, the entry-point-in-HNSW glossary page shows the most consequential single instance of this process in action — the entry point is simply whichever node’s maximum layer happened to reach the highest level currently present anywhere in the hierarchy.