UNCO: Towards Unifying Neural Combinatorial Optimization through Large Language Model

Xia Jiang, Yaoxin Wu, Yuan Wang, Yingqian Zhang · OpenReview

Abstract

Recently, applying neural networks to address combinatorial optimization problems (COPs) has attracted considerable research attention. The prevailing methods always train deep models independently on specific problems, lacking a unified framework for concurrently tackling various COPs. To this end, we propose a unified neural combinatorial optimization (UNCO) framework to solve different types of COPs by a single model. Specifically, we use natural language to formulate text-attributed instances for different COPs and encode them in the same embedding space by the large language model (LLM). The obtained embeddings are further advanced by an encoder-decoder model without any problem-specific modules, thereby facilitating a unified process of solution construction. We further adopt the conflict gradients erasing reinforcement learning (CGERL) algorithm to train the UNCO model, delivering better performance across different COPs than vanilla multi-objective learning. Experiments show that the UNCO model can solve multiple COPs after a single-session training, and achieves satisfactory performance that is comparable to several traditional or learning-based baselines. Instead of pursuing the best performance for each COP, we explore the synergy between tasks and few-shot generalization based on LLM to inspire future work.

Introduction

Combinatorial Optimization Problems (COPs), such as the Traveling Salesman Problem (TSP) and the Knapsack Problem (KP), are fundamental challenges in computer science, often classified as NP-hard. Traditionally, solving these problems required either hand-crafted heuristics or specialized Neural Combinatorial Optimization (NCO) models designed for a single specific task. While Large Language Models (LLMs) have shown promise in reasoning, they often struggle with the direct execution of complex optimization tasks due to context window limitations and structural reasoning failures. The Unified Neural Combinatorial Optimization (UNCO) framework addresses these limitations by using LLMs as universal feature extractors within a unified solver architecture.

The UNCO Framework

The UNCO framework bridges the gap between linguistic problem descriptions and mathematical solution generation through a three-part architecture: a frozen LLM encoder, a trainable solution generator, and a multi-task reinforcement learning strategy.

The UNCO framework architecture, illustrating the flow from text-attributed instances through the LLM to the solution generator.

The LLM Encoder acts as a sophisticated feature extractor. It takes "Text-attributed Instances" (TAIs)—descriptions of the problem and its specific data—and maps them into a unified semantic space. The Solution Generator consists of a Connector for dimensionality reduction, a Transformer-based Encoder, and a Unified Decoder. This component learns the rules of solution construction, building valid solutions step-by-step based on the LLM's embeddings.

Text-Attributed Instances (TAIs)

A key innovation of UNCO is the formulation of COPs as TAIs. Instead of raw numerical input, problems are described in natural language, combining task descriptions with instance-specific data and heuristic hints.

Examples of Text-attributed Instances (TAIs) for TSP and KP, showing how task and instance descriptions are combined into a natural language format.

Including basic heuristic information (e.g., the top-3 nearest neighbors for a node in TSP) in the text description significantly boosts the LLM's ability to represent the problem effectively. This allows the model to leverage its pre-trained semantic knowledge to understand the underlying mathematical structure.

Multi-Task Training with CGERL

Training a single model to solve multiple COPs simultaneously is challenging because the optimization objectives for different tasks may conflict. The researchers developed the Conflict Gradients Erasing Reinforcement Learning (CGERL) algorithm to address this. CGERL identifies when gradients from different tasks are in conflict (indicated by negative cosine similarity) and projects them onto a normal plane. This ensures that the model learns from all tasks harmoniously without one task's learning signal degrading performance on another.

Key Results and Generalization

UNCO was evaluated on five representative COPs: TSP, CVRP, KP, MVCP, and SMTWTP.

  • Superiority over LLM Baselines: UNCO significantly outperformed other LLM-based approaches. For instance, on a 100-node TSP, UNCO achieved an optimality gap of 4.38%, whereas many other LLM-based methods failed to produce valid results at that scale.
  • Competitive Performance: The framework proved competitive with standard heuristics and metaheuristics like Ant Colony Optimization (ACO), and even rivaled specialized NCO models in some scenarios.
  • Few-Shot Generalization: Because the LLM understands the "language" of optimization, UNCO can be adapted to entirely new problem types (e.g., VRP with Backhauls) or larger problem sizes with minimal additional fine-tuning.

Conclusion

UNCO represents a significant step toward a universal solver for combinatorial optimization. By combining text-based problem representation with a specialized neural decoder and conflict-free training, UNCO provides a flexible and scalable alternative to problem-specific solvers. Future research will explore further scaling and the integration of even larger pre-trained models to close the gap with state-of-the-art numerical solvers.

Summary updated

BibTeX
@misc{jiang2024unco,
  author = {Xia Jiang and Yaoxin Wu and Yuan Wang and Yingqian Zhang},
  title = {{UNCO: Towards Unifying Neural Combinatorial Optimization through Large Language Model}},
  year = {2024},
  eprint = {2408.12214},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.12214},
}
Figure