Algorithmically Aligned Neural Agglomerative Tree Construction

Robert R Nerem, Pranav Singh, Cheyenne Ward, Yusu WangarXiv 2026

TL;DR

NN-LINKAGE is a new neural hierarchical clustering model that is "algorithmically aligned" with classical linkage rules. By mirroring the recursive structure of the Lance-Williams recurrence, it learns custom, data-driven merge strategies that generalize to large datasets while maintaining the $O(n^2 \log n)$ efficiency of traditional algorithms.

What Problem Does This Paper Address?

Hierarchical Clustering (HC) is a cornerstone of data analysis, used in everything from building evolutionary trees in biology to routing clock signals in microchips. Traditionally, researchers use hand-designed "linkage rules" (like Single Linkage or Complete Linkage) to decide which clusters to merge next. However, these rules are fixed and often fail to capture the nuances of complex, real-world data.

While deep learning offers a way to learn better rules from data, most neural HC models struggle with two things: efficiency and size generalization. They are often too slow for large datasets and fail to work correctly on problems larger than the ones they were trained on. The authors aim to bridge this gap by creating a model that is as flexible as a neural network but as robust and efficient as a classical algorithm.

Methods

The core innovation is algorithmic alignment. The authors designed NN-LINKAGE to follow the computational blueprint of the Lance-Williams (LW) recurrence, a generalized framework that encompasses most classical linkage methods.

Instead of just updating a single distance value between clusters, NN-LINKAGE maintains learned merge embeddings (vectors) for every pair of candidate clusters. The process works as follows:

  1. Point Encoding: Input points are turned into initial embeddings using an MLP or a Transformer.
  2. Initialization: MLP_init creates initial merge embeddings for all pairs of individual points.
  3. Recursive Update: When two clusters $A$ and $B$ are merged, MLP_update calculates new embeddings for the new cluster $\{A \cup B\}$ relative to all other clusters $C$. This mirrors the LW update step.
  4. Scoring: A linear layer turns these embeddings into a scalar score used to rank merges in a priority queue, ensuring $O(n^2 \log n)$ time complexity.
Figure 1: NN-LINKAGE initializes merge embeddings from encoded points and recursively updates them from stored embeddings. A shared linear scorer orders candidate merges in a priority queue.

Datasets

The authors evaluated the model across three distinct domains:

  • Rings and Disks: A synthetic "toy" problem where different parts of the dataset require different clustering strategies (Single Linkage for rings, Complete Linkage for disks).
  • Clock-Tree Routing (VLSI): A critical engineering task in chip design. The model was trained on optimal solutions for 20-point sets and tested on benchmarks with up to 1,000 points (BST-DME and ISPD collections).
  • Phylogenetic Reconstruction: Inferring evolutionary trees from Multiple Sequence Alignment (MSA) data. They used synthetic data generated via AliSim and real-world molecular sequences from the Zhou et al. (2018) dataset.

Key Insights and Ideas

  • Universal Approximation: The authors prove that NN-LINKAGE can approximate any continuous linkage function. More impressively, it can exactly realize standard algorithms like Single Linkage or Ward’s method across all input sizes.
  • Local Adaptability: Unlike fixed rules, NN-LINKAGE can learn to apply different logic to different parts of the same dataset. In the "Rings and Disks" experiment, it automatically switched between SL-like and CL-like behavior based on the local point configuration.
  • Size Generalization via Alignment: Because the model's structure is tied to a recursive algorithm, it generalizes remarkably well. A model trained only on 20 points outperformed industry-standard heuristics on 500-point VLSI problems.
  • Global Context: By using a Transformer as the initial encoder, the model can incorporate global information (like $k$-nearest neighbor distances) into its local merge decisions, allowing it to approximate advanced rules like "Robust Single Linkage."

Key Results

  • VLSI Design: NN-LINKAGE outperformed Complete Linkage (the state-of-the-art heuristic) on average across all tested sizes. When used as a refinement tool, it extended the Pareto frontier, achieving better objective values than classical methods in less time.
Figure 3: Clock-tree results. Mean percentage change in the sum-of-diameters objective relative to raw CL; negative values indicate improvement. (a) Means over 50 held-out point sets per size, with error bars showing one standard error. (b) Mean objective change and runtime over 20 VLSI instances; point labels indicate the refinement parameter k.
  • Biology: In phylogenetic reconstruction, NN-LINKAGE achieved a 5x speedup over the previous leading neural method (NeuralNJ) while maintaining comparable accuracy on synthetic data and slightly improving accuracy on real-world data.
Figure 4: Synthetic data comparison. Mean nor- malized RF distance and runtime over 1,152 in- stances, equally weighting the nine size–length settings. Dashed lines join nondominated points. Lower RF and runtime are better.
  • Rings and Disks: The model achieved 99.6% accuracy, far surpassing the 85.18% achieved by the best-tuned classical baseline.

Limitations and Future Work

  • Memory Constraints: While computationally efficient in terms of operations, the model ran out of GPU memory on a small number of extremely large phylogenetic instances (those with very long sequences).
  • Supervision Requirements: The current model requires "target trees" for training. Future work could explore training the model to minimize explicit cost functions (like Dasgupta’s HC cost) directly, which are often NP-hard to optimize.
  • Theoretical Bounds: The authors suggest investigating whether learned rules can provide better theoretical approximation guarantees for combinatorial optimization problems than existing hand-designed heuristics.

Summary updated

BibTeX
@misc{nerem2026algorithmically,
  author = {Robert R Nerem and Pranav Singh and Cheyenne Ward and Yusu Wang},
  title = {{Algorithmically Aligned Neural Agglomerative Tree Construction}},
  year = {2026},
  eprint = {2610.07271},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.07271},
}
Figure