Generalize a Small Pre-trained Model to Arbitrarily Large TSP Instances

Zhang-Hua Fu, Kai-Bin Qiu, Hongyuan Zha

Abstract

The Traveling Salesman Problem (TSP) remains a fundamental challenge in combinatorial optimization. While deep learning has shown promise in learning heuristics for TSP, existing models often fail to generalize to instances significantly larger than their training sets. We present a hybrid approach that trains on small instances (20-50 nodes) and generalizes to solve instances with up to 10,000 nodes. Our method utilizes a Graph Convolutional Residual Network with attention (Att-GCRN) to generate edge "heat maps" via a sample-and-merge strategy, which then guides a Monte Carlo Tree Search (MCTS) refined by reinforcement learning. Our model achieves state-of-the-art performance among learning-based solvers, reaching a 0.037% optimality gap on 100-node instances and successfully scaling to 10,000-node problems.

Introduction

The Traveling Salesman Problem (TSP) is a classic NP-hard problem: finding the shortest Hamiltonian cycle in a graph. Traditional exact solvers like Concorde and heuristics like LKH3 are highly effective but rely on extensive hand-crafted rules. Recent machine learning (ML) approaches aim to automate rule discovery, yet they frequently encounter a "generalization wall." Models trained on small graphs (e.g., 50 nodes) typically perform poorly on larger graphs (e.g., 500 nodes) due to distribution shifts. Moreover, training on large instances is hindered by the computational cost of obtaining optimal labels for supervised learning. This research addresses the challenge of "training small to solve big" by leveraging the local consistency of optimal TSP edge patterns.

Methodology

The proposed pipeline consists of three main stages: off-line supervised learning, heat map merging, and online MCTS search.

Overview of the proposed hybrid pipeline for solving large-scale TSP instances.

1. Off-line Supervised Learning

A Graph Convolutional Residual Network with attention (Att-GCRN) is trained on small-scale instances (e.g., $n=20$ or $n=50$). The model learns to output a "heat map"—a probability distribution over the edges indicating the likelihood of an edge belonging to the optimal tour.

2. Heat Map Merging for Large Instances

To handle instances with thousands of nodes, the system employs a Graph Sampling strategy. Overlapping sub-graphs of size $m$ (matching the training size) are extracted, normalized to a unit square, and processed by the pre-trained Att-GCRN. These local heat maps are then fused into a single global heat map. This approach relies on the insight that local geometric patterns indicative of optimal edges are largely invariant to total graph size.

3. MCTS Search (Online RL)

The global heat map serves as a prior to guide a Monte Carlo Tree Search. Unlike constructive MCTS, this version iteratively improves a complete tour using $k$-opt moves. The search space is significantly pruned by the heat map, and the policy is further refined via reinforcement learning during the search process itself.

Experimental Results

The model was evaluated on standard benchmarks ($n=20, 50, 100$) and a new set of large-scale instances ranging from $n=200$ to $n=10,000$.

Performance on Standard Benchmarks

The proposed Att-GCRN+MCTS model achieves near-optimal results on small-scale instances. Notably, when trained on $n=50$, it achieves an average gap of only 0.037% from optimality on $n=100$ instances, outperforming previous state-of-the-art ML models like GAT and GCN as shown in the comparison below.

Comparison of the proposed method against exact solvers and state-of-the-art learning-based baselines across different TSP sizes.

Scaling to 10,000 Nodes

The model demonstrates remarkable zero-shot generalization. On 10,000-node instances, where most ML baselines fail due to memory constraints, our approach achieved a gap of 4.39% relative to the LKH3 heuristic. Ablation studies confirmed the importance of the heat map; without it, MCTS performance degrades drastically (e.g., the gap on $n=500$ increases from 2.5% to over 1300%).

Conclusion

This work demonstrates that a "sample-and-merge" strategy combined with hybrid search can effectively bridge the gap between small-scale training and large-scale application in combinatorial optimization. While the model currently trails classical heuristics like LKH3 on the largest scales, it represents a significant advancement for neural TSP solvers. Future work will explore non-Euclidean generalizations and application to other routing problems.

Summary updated

BibTeX
@inproceedings{fu2021generalize,
  author = {Zhang-Hua Fu and Kai-Bin Qiu and Hongyuan Zha},
  title = {{Generalize a Small Pre-trained Model to Arbitrarily Large TSP Instances}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i8.16916},
}
Figure