Paper commentary
Neural Combinatorial Optimization with Reinforcement Learning
Neural networks trained with reinforcement learning can construct near-optimal traveling salesman tours
- Problem Exact solvers for the traveling salesman problem stall beyond about 40 cities, and strong heuristics must be redesigned whenever the problem changes slightly. Supervised learning needs optimal labels that are usually unavailable for these problems.
- Method Neural Combinatorial Optimization trains a pointer network policy with policy gradients. Tour length is the reward, so no optimal labels are needed, and at test time it decodes greedily, samples tours, or runs Active Search.
- Results On TSP100, RL pretraining with greedy decoding reached an average tour length of 8.30, against 10.81 for the supervised baseline. On KnapSack with 200 items, Active Search reached 57.45, equal to the optimal value.
Why learned search for routing
Exact dynamic programming for the TSP becomes impractical as the number of cities grows, and the authors place the practical limit near 40 points. State-of-the-art solvers avoid that wall by relying on carefully designed heuristics, and they can handle symmetric instances with thousands of nodes.
Such heuristics are tuned to one problem statement, so a small change to the statement often forces them to be revised. The authors aim for a method that learns its own search strategy from training data, which would reduce the hand engineering needed for each new task.
Supervised learning needs a labeled output for each input, and for combinatorial problems optimal labels are generally not available. A candidate solution can instead be scored by a verifier, and that score can serve as the reward for a learning algorithm. The authors also report that a supervised pointer network trained on optimal tours generalizes poorly compared with an agent that explores tours and observes their rewards.
How the policy builds a tour
The policy writes the probability of a tour as a product over positions, so each city is chosen given the cities already placed, which follows from the chain rule. The probability is written as \(p(\pi \mid s)=\prod_{i=1}^{n} p(\pi(i)\mid \pi(<i), s)\), and each factor is produced by a softmax module. The quantity to minimize is the tour length \(L(\pi \mid s)\), which sums the \(\ell_2\) distances between consecutive cities and adds the edge that closes the tour back to the start.
The policy is a pointer network, so its output is a distribution over input positions rather than over a fixed vocabulary, which lets one model handle graphs of different sizes. An LSTM encoder reads the cities one at a time, after each 2D point is linearly mapped into a d-dimensional embedding. A decoder LSTM produces a query at each step, and an attention-style pointing step turns that query into a probability over the encoder states.
The first decoder input is a trainable vector rather than a city. The pointing mechanism uses one glimpse, which the authors found gave performance gains at small latency cost. Cities already visited are excluded at each decoding step, so every decoded permutation is a valid tour.
Training the policy without labels
The training objective is the expected tour length under the policy, averaged over graphs drawn from a training distribution, and it is minimized. Its gradient is estimated with the REINFORCE estimator, which weights the gradient of the log-probability of each sampled tour by that tour's length minus a baseline.
In each update, a batch of B graphs is drawn, one tour is sampled per graph, and the gradient is approximated by averaging over the batch. Algorithm 1 applies Adam to the policy parameters and to the critic parameters at every training step.
A common baseline is an exponential moving average of past rewards. Because one average is shared across the batch, it cannot separate a hard graph from an easy one, so a good tour on a hard graph can be discouraged when its length is above the shared baseline.
Why a learned critic baseline
The critic is an auxiliary network that predicts the expected tour length of the current policy for each input graph. It is trained with a mean squared error between its predictions and the lengths of the sampled tours.
The critic encoder has the same architecture as the policy encoder, and a process block then runs P steps over the hidden state, glimpsing the memory states at each step. A decoder of two fully connected layers, with d and 1 units, turns the final hidden state into a single scalar baseline.
The authors relate the training scheme to asynchronous advantage actor-critic, since the difference between sampled tour lengths and critic predictions serves as an advantage estimate. Updates are performed asynchronously across several workers, and each worker processes a mini-batch of graphs.
Using the policy at test time
Sampling draws several tours from the stochastic policy and keeps the shortest one. A temperature hyperparameter controls how diverse the samples are, and sampling gave clear gains over greedy decoding, which always picks the city with the largest probability. The authors also tried perturbing the pointing mechanism with noise before greedy decoding, but sampling worked better in their experiments.
Active Search starts from a random solution and updates the policy parameters on the single test graph. Each update samples a batch of tours, moves the best-so-far solution to the shortest sampled tour when that tour is shorter, and uses an exponential moving average baseline.
The input cities are randomly shuffled before being fed to the pointer network, which adds stochasticity to sampling. The authors report that the shuffle leads to large improvements in Active Search. Four configurations combine RL pretraining, greedy decoding, sampling and Active Search, and differ in whether training data and test-time refinement are used.
Experimental setup
The three TSP benchmarks are TSP20, TSP50 and TSP100, and each has a test set of 1,000 graphs.
The models are trained with Adam, starting from a learning rate of 10−3 for TSP20 and TSP50 and 10−4 for TSP100, and that rate decays by a factor of 0.96 every 5000 steps. Parameters are initialized uniformly within [−0.08, 0.08], the L2 norm of the gradients is clipped to 1.0, and the Active Search baseline decay is set to α = 0.99.
The supervised comparison uses one million optimal tours as training data. The authors' supervised results fell short of those in the original pointer network work, so they quote the earlier values for TSP20 and TSP50 and report their own only for TSP100.
RL pretraining draws fresh training mini-batches on the fly, and hyperparameters are chosen on a validation set of 10,000 instances. The critic has three processing steps and two fully connected layers on top of the policy encoder, and logits are clipped to [−10, 10] with tanh to help exploration. Greedy decoding is also run from a set of 16 pretrained models, and the shortest tour across them is kept.
Active Search after pretraining runs for up to 10,000 training steps with batch size 128, using a learning rate set to a hundredth of the initial training rate. That initial training rate was 10−5 for TSP20 and TSP50 and 10−6 for TSP100. Active Search from an untrained model runs for 100,000 training steps on TSP20 and TSP50 and 200,000 on TSP100.
The baselines are Christofides, whose solutions are guaranteed within a 1.5 ratio of optimality, and the OR-Tools vehicle routing solver. Optimal references come from Concorde, and from LK-H, which the authors empirically found to reach optimal tours on all their test sets.
TSP tour quality and running time
On TSP100, the supervised baseline reached an average tour length of 10.81, while RL pretraining-Greedy reached 8.30. The TSP20 and TSP50 supervised values are marked as taken from the earlier pointer network paper, so they are not measured under the authors' own setup.
On TSP100, Active Search after RL pretraining reached 7.83, against 7.77 for the optimal reference, where lower tour length is better. The authors report that every variant comfortably beats the Christofides heuristic, and that greedy decoding does this without any search.
Averaged over the test set, greedy decoding took 0.01s on TSP100, while LK-H took 0.88s. The greedy methods ran on a single Nvidia Tesla K80 GPU, whereas Concorde and LK-H ran on Intel Xeon CPUs. The authors describe both greedy approaches as time-efficient and only a few percent worse than optimal.
Search budget and solution counts
Searching at inference time pushes tours closer to optimal but lengthens the run, and both sampling and Active Search can be stopped early at a small cost in final tour length. On TSP50, RL pretraining-Sampling with the tuned temperature reached 5.70 at 1,280,000 solutions, the same as Active Search, and 5.80 at 128 solutions. On TSP100, Active Search reached 7.87 at 128,000 solutions, taking 1200s, and 7.83 at 1,280,000 solutions, taking 12000s.
The authors also plot the sorted ratios of each method's tour length to optimal, which shows how the gaps are spread across test graphs. The authors say that for small solution spaces, sampling with a tuned softmax temperature outperforms Active Search, which sometimes steers toward suboptimal regions. For larger solution spaces, Active Search is superior both when the number of sampled solutions is held fixed and when runtime is held fixed.
Active Search from an untrained model still produced competitive tours, but it required 7 and 25 hours per instance on TSP50 and TSP100. Within the authors' comparison, Neural Combinatorial Optimization beats simulated annealing, is slightly less competitive than tabu search, and is clearly behind guided local search.
Applying the framework to other problems
The model architecture depends on the problem: a pointer network suits outputs that are permutations, truncated permutations or subsets of the input, and a sequence-to-sequence model suits other structured outputs. For problems that assign labels to inputs, such as graph coloring, a pointer module can be combined with a softmax module to point and assign at decoding time.
The training procedure of the TSP experiments carries over once the reward is adapted to the problem being solved. Feasibility is the harder part, since some problems offer no easy way to know which decoding branches lead to a feasible solution.
Penalizing infeasible solutions in the objective is one option, with infeasible samples ignored or resampled at inference, and the authors leave its verification to future work.
KnapSack results
The 0-1 KnapSack problem maximizes the total value of chosen items subject to a total weight at most W, and with real-valued weights and values it is NP-hard. A simple heuristic adds items in order of their weight-to-value ratio until the capacity is filled.
Each instance is encoded as a sequence of (wi, vi) pairs, and decoding stops once the weight of the collected items exceeds the capacity. Three sets of one thousand instances, KNAP50, KNAP100 and KNAP200, have weights and values drawn uniformly from [0, 1], with capacities of 12.5 for KNAP50 and 25 for KNAP100 and KNAP200. Active Search runs for 5,000 training steps, and the baselines are the greedy ratio heuristic and random search over as many feasible solutions as Active Search examines.
On KNAP50, RL pretraining-Greedy reached 19.86 against an optimal value of 20.07, and random search reached 17.91. On KNAP200, RL pretraining-Greedy reached 57.10, Active Search reached 57.45, equal to the optimal value, and the greedy ratio heuristic reached 55.42. The authors state that RL pretraining-Greedy is on average about 1% below the optimal value, and that Active Search solves all instances to optimality.
Limitations
Active Search from an untrained model needed 7 and 25 hours per instance on TSP50 and TSP100, which limits its practical use. Search at inference time adds runtime in proportion to the number of sampled solutions, so the gains come with a larger compute bill.
RL training generalizes according to the distribution of its training data, whereas the authors describe Active Search as independent of that distribution. The TSP experiments use only uniformly random points in the unit square with up to 100 cities.
In the authors' own experiments, the supervised pointer network trained on optimal TSP100 tours performs worse than the results reported in the original work. The temperatures for sampling come from a grid search on each size, so they are tuned rather than fixed across problems.
The time-window case and the penalty-based feasibility approach are discussed but not tested in the experiments. Enforcing constraints through a penalty term does not guarantee feasible samples at inference time, and the authors leave that to future verification.
Paper info
- Authors
- Irwan Bello, Hieu Pham, Quoc V. Le, Mohammad Norouzi, Samy Bengio
- Venue
- arXiv · Preprint
- First published
- 2016-11-29
- Added
- 2026-11-12
- Updated
- 2017-1-12
- Version
- v3
- arXiv
- 1611.09940
- Category
- cs.AI · cs.LG · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Irwan Bello, Hieu Pham, Quoc V. Le, Mohammad Norouzi, Samy Bengio (2016). Neural Combinatorial Optimization with Reinforcement Learning. arXiv:1611.09940v3. https://arxiv.org/abs/1611.09940v3
BibTeX
@misc{bello2016neural,
title = {{Neural Combinatorial Optimization with Reinforcement Learning}},
author = {Irwan Bello and Hieu Pham and Quoc V. Le and Mohammad Norouzi and Samy Bengio},
year = {2016},
eprint = {1611.09940},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1611.09940v3}
}