Large Language Models as End-to-end Combinatorial Optimization Solvers

Xia Jiang, Yaoxin Wu, Minshuo Li, Zhiguang Cao, Yingqian Zhang

Introduction

Combinatorial Optimization (CO) is a fundamental challenge in logistics, manufacturing, and resource allocation. Traditionally, solving NP-hard problems like the Traveling Salesman Problem (TSP) or Job-Shop Scheduling (JSSP) requires specialized algorithms or commercial solvers like Gurobi, demanding significant domain expertise. While Large Language Models (LLMs) have excelled in general reasoning, their performance as direct, end-to-end CO solvers has historically been hampered by high "optimality gaps" and frequent "hallucinations" of infeasible solutions.

This research presents a framework to transform 7B-parameter LLMs into high-performance CO solvers. By integrating supervised fine-tuning with a novel reinforcement learning strategy, the authors demonstrate that relatively small models can outperform massive general-purpose models like GPT-4o and specialized reasoning models across a variety of complex optimization tasks.

Methodology: The FOARL Framework

The proposed approach moves beyond simple prompting, employing a multi-stage training pipeline to instill both the logic of optimization and the rigor of constraint satisfaction.

The end-to-end training and inference pipeline for CO solvers.

1. Supervised Fine-Tuning (SFT)

The model (Qwen2.5-7B) is initially trained on 500,000 problem-solution pairs. A key innovation here is the use of Text-Attributed Instances (TAIs). Instead of raw data, the model receives problem descriptions augmented with "latent heuristic features"—such as the nearest neighbors in a routing task. This provides the model with structural cues that guide its attention toward promising solution spaces.

2. Feasibility-and-Optimality-Aware Reinforcement Learning (FOARL)

The authors identified an "over-greedy" trap in SFT-only models: they often prioritize cost reduction at the expense of feasibility, leading to minor but critical constraint violations. To correct this, they implement Group Relative Policy Optimization (GRPO) with a dual reward system:

  • Feasibility Reward: Strictly penalizes any violation of problem constraints.
  • Optimality Reward: Incentivizes finding solutions with lower objective costs.

3. Best-of-N (BoN) Inference

During deployment, the model generates $N$ candidate solutions. The system then selects the best feasible solution among the samples, further ensuring reliability and performance.

Experimental Results

The framework was evaluated across seven NP-hard problems, including routing (TSP, OP, CVRP), graph problems (MIS, MVC), and scheduling (PFSP, JSSP).

Comparison of feasibility and optimality gaps across various models and CO problems.

Feasibility and Optimality

As shown in the results table, the full pipeline (SFT+RL+BoN) achieves a 100% feasibility rate on nearly all tasks. More impressively, it reduces the average optimality gap to between 1.03% and 8.20%. In contrast, general-purpose models like GPT-4o often exhibit optimality gaps exceeding 30-50% and struggle significantly with feasibility in complex constraints like those found in CVRP.

Comparison with Reasoning Models

The 7B solver also outperformed specialized reasoning models like DeepSeek-R1 and OpenAI o1. While these models use extensive Chain-of-Thought (CoT) processing, they often fail to converge on valid solutions for large-scale optimization instances. Furthermore, the 7B model is significantly faster, providing solutions in seconds rather than the minutes required for long-form reasoning.

Conclusion

This work demonstrates that targeted training—combining heuristic-aware data with feasibility-focused reinforcement learning—can turn compact LLMs into powerful, end-to-end optimization engines. By bypassing the need for external code generation or solver calls, this approach offers a more direct and natural language-accessible interface for complex industrial problems. Future work will focus on scaling these models to handle thousands of variables and further optimizing textual representations for even greater efficiency.

Summary updated

BibTeX
@inproceedings{jiang2025large,
  author = {Xia Jiang and Yaoxin Wu and Minshuo Li and Zhiguang Cao and Yingqian Zhang},
  title = {{Large Language Models as End-to-end Combinatorial Optimization Solvers}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=qr5uMEs6iR},
}
Figure