Vehicle Routing Problems (VRPs) are fundamental to many real-world applications. Recent advances in large language models (LLMs) have spurred progress in solving these NP-hard problems. However, most existing approaches assume that input instances are error-free, neglecting the presence of faults commonly encountered in real-world data. In this work, we systematically investigate the capability of LLMs to detect (and correct) errors in VRP instances, and identify key limitations, particularly in handling complex instances or errors that substantially increase the LLM's reasoning burden. To overcome these challenges, we propose a self-guided reasoning framework in which LLMs autonomously generate code that provides structured insights to aid in error diagnosis. Experiments across diverse problem settings and LLMs demonstrate that our framework significantly improves error detection performance, achieving near-perfect accuracy.
Figures & tables
Figure 1: Overall error detection performance across different VRP variants, with a breakdown by error type shown below (higher is better).
Figure 2: Effect of fault number and instance scale.
Figure 3: Effect of reasoning depth on error detection performance across different VRP variants.
Figure 4: Overall framework of Self-Guided Reasoning.
Constraint Type
1
2
3
4
5
6
LLM (%)
87.27
79.42
72.42
57.42
53.97
22.30
Table 1: Average error detection rates of LLMs under different numbers of constraint types. (higher is better).
EDR(%)
Time(m)
EDR(%)
Time(m)
EDR(%)
Time(m)
EDR(%)
Time(m)
EDR(%)
Time(m)
EDR(%)
Time(m)
CVRP
OCVRP
CVRPTW
CVRPL
MDCVRP
CVRPB
LLM
87.25
6.35
91.88
6.20
66.50
7.00
59.50
7.38
94.42
8.15
78.50
8.25
Self-Guided
99.49
6.39
97.98
7.20
95.00
7.22
100.00
8.56
97.47
9.54
94.00
9.03
CVRPMB
OCVRPTW
MDOCVRP
OCVRPB
CVRPLTW
MDCVRPL
LLM
77.95
9.45
79.50
10.96
94.50
8.17
84.00
8.55
59.61
9.21
59.11
8.50
Self-Guided
96.92
9.97
98.00
10.87
98.50
8.32
94.00
8.52
99.51
8.93
94.09
9.45
Table 2: Error Detection Rate (EDR) comparison across 48 VRP variants (higher is better).
Scale
50
100
Fault Number
5
10
15
5
10
15
EDR(%)
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
CVRP
97.00
100.00
87.25
99.49
86.82
98.99
94.00
98.00
89.80
97.96
82.33
97.90
CVRPTW
79.00
97.00
66.50
95.00
63.67
90.33
68.00
98.00
64.00
93.00
62.33
87.67
CVRPB
82.00
94.00
78.50
94.00
56.02
91.73
76.00
95.00
77.00
92.00
53.33
92.33
OCVRPB
93.00
95.00
84.00
94.00
71.62
88.85
85.00
99.00
79.00
89.00
64.33
87.00
Table 3: Impact of instance scale and fault number on EDR for LLM and the Self-Guided framework.
Reasoning Depth
1
2
3
4
5
EDR(%)
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
CVRP
87.25
99.49
94.89
100.00
96.42
100.00
97.45
100.00
97.96
100.00
CVRPTW
66.50
95.00
68.00
98.00
69.00
98.00
70.00
99.00
72.50
100.00
CVRPB
78.50
94.00
85.00
96.00
90.00
96.00
94.00
99.00
99.00
100.00
OCVRPB
84.00
94.00
88.50
99.50
90.50
100.00
93.00
100.00
94.50
100.00
CVRPMBL
65.00
91.50
67.50
95.50
69.00
100.00
70.00
100.00
70.50
100.00
Table 4: Impact of Reasoning Depth on EDR for LLM and the Self-Guided Framework
LLM
Self-Refine
Critic-Guided Refinement
CoT
Self-Guided
EDR(%)
Time(m)
EDR(%)
Time(m)
EDR(%)
Time(m)
EDR(%)
Time(m)
EDR(%)
Time(m)
CVRP
87.25
6.35
92.86
9.60
92.35
9.12
91.33
7.13
99.49
6.39
CVRPTW
66.50
7.00
69.00
11.66
68.50
13.92
69.00
8.10
95.00
7.22
CVRPB
78.50
8.25
82.00
11.43
83.50
10.52
83.00
7.60
94.00
9.03
OCVRPB
84.00
8.55
84.50
11.33
86.00
11.08
85.00
6.78
94.00
8.52
CVRPMBL
65.00
7.63
69.00
10.12
70.50
10.50
67.00
5.88
91.50
7.93
Table 5: Comparison with Different Prompt Strategies.
LLM
Code
EDR(%)
Time(m)
EDR(%)
Time(m)
1D BPP
94.50
5.88
97.50
6.00
2D BPP
90.00
6.97
94.50
7.35
Table 6: EDR and Runtime on Bin Packing Problems.
GPT-4.1
GPT-4o
Claude-4
LLM
Self-Guided
LLM
Self-Guided
LLM
Self-Guided
CVRP
87.25
99.49
85.71
98.99
91.84
100.00
CVRPTW
66.50
95.00
60.00
93.50
68.50
96.00
CVRPB
78.50
94.00
75.00
93.00
80.00
95.50
OCVRPB
84.00
94.00
85.50
95.00
86.50
95.50
CVRPMBL
65.00
91.50
63.00
90.00
66.50
92.00
Table 7: Comparison across different LLMs with and without the Self-Guided framework on EDR (%).
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Constraint
Description
C
Capacity constraint, which limits the total demand served by each vehicle so that it does not exceed its carrying capacity.
O
Open route constraint, where vehicles are not required to return to the depot after completing their routes.
B
Backhaul constraint, where customers are partitioned into linehaul and backhaul sets, and vehicles are required to serve all linehaul customers before visiting any backhaul customers on each route.
MB
Mixed backhaul constraint, which relaxes strict service ordering and allows limited interleaving of linehaul and backhaul customers.
L
Distance limit constraint, which restricts the maximum travel distance of each route.
TW
Time window constraint, requiring each customer to be served within a specified time interval.
Appendix
Table 8: Summary of VRP constraints considered in this work.
VRP Variant
C Capacity
O Open
B Backhaul
MB Mixed Backhaul
L Distance Limit
TW Time Windows
MD Multi-Depot
CVRP
✓
OCVRP
✓
✓
CVRPB
✓
✓
CVRPL
✓
✓
CVRPTW
✓
✓
OCVRPTW
✓
✓
✓
Appendix
Table 9: VRP variants and their associated constraints.
CVRP
OCVRP
MDCVRP
CVRPB
CVRPMB
CVRPTW
CVRPL
LLM
2
1
0
11
13
4
0
Self-Guided
0
0
0
0
0
0
0
Appendix
Table 10: Number of faults detected by LLM on correct VRP instances.
(%)
CVRP
OCVRP
MDCVRP
CVRPB
CVRPMB
CVRPTW
CVRPL
LLM
65
85
85
55
75
10
5
Self-Guided
95
95
95
85
90
90
100
Appendix
Table 11: Percentage of instances where all faults are correctly detected.
AFL
CVRP
CVRPTW
CVRPB
OCVRPB
CVRPMBL
MDCVRPMBTW
MDOCVRPBTW
MDOCVRPMBLTW
Obj.
14.19
14.59
14.87
9.30
10.14
12.83
8.71
7.91
Time (s)
10.51
11.01
10.94
11.42
12.63
11.91
12.14
12.72
Appendix
Table 12: Downstream solver performance on repaired VRP instances.
EDR(%)
1
2
3
4
5
6
LLM
87.27
79.42
72.42
57.42
53.97
22.30
Code
99.49
96.90
96.33
95.12
97.96
98.78
Appendix
Table 13: EDR under different counts of constraint types.
Method
CVRP
OCVRP
MDCVRP
CVRPB
CVRPMB
CVRPTW
CVRPL
LLM
80.50
83.00
90.00
71.50
69.00
60.50
58.00
Self-guided
97.50
95.50
96.00
89.50
91.00
89.00
87.00
Appendix
Table 14: Error Detection Rate (EDR, %) on the more challenging hard-mode dataset, where multiple errors may occur within the same node.
Error Type / Method
CVRP
OCVRP
MDCVRP
CVRPB
CVRPMB
CVRPTW
CVRPL
Format (LLM)
0
0
–
–
1
0
0
Format (Self-guided)
0
0
–
–
0
0
0
Capacity (LLM)
2
1
–
–
0
1
0
Capacity (Self-guided)
0
0
–
–
0
0
0
Backhaul (LLM)
–
–
11
12
–
–
–
Backhaul (Self-guided)
–
–
0
0
–
–
–
Appendix
Table 15: False-positive analysis on valid instances. Each entry denotes the number of valid instances incorrectly identified as containing the corresponding error type. “–” indicates that the error type is not applicable to the corresponding VRP variant.
Vehicle Routing Problems (VRPs) are fundamental combinatorial optimization problems with widespread applications in various scenarios. The advanced optimization solvers can effectively solve such problems. However, modeling complex VRP variants for solvers often requires substantial domain expertise, which limits the accessibility of advanced optimization technologies. In this paper, we propose Reinforcement Learning Enhanced LLMAgents(RLEA), a multi-agent framework designed to automate the modeling of complex VRPs. RLEA introduces a lightweight neural Planner trained with Soft Q-learning to efficiently orchestrate the actions of LLM-based agents. In addition, we equip the system with an evolutionary memory module and retrieval-augmented generation, enabling the agent to leverage both accumulated experience and external solver knowledge during program generation and refinement for solving VRPs. We evaluated 48 distinct VRP variants across various solvers. The experimental results demonstrate that RLEA outperforms the previous state-of-the-ar method, achieving a 16.67% higher success rate while significantly reducing runtime errors. These results validate that integrating reinforcement learning with LLM-based reasoning is highly effective for automated optimization modeling. The appendix is available at: https://doi.org/10.5281/zenodo.19134435.
Yi Chen, Zikang Yu, Jiahai Wang +3
School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510006, China · Department of Industrial Systems Engineering and Management, National University of Singapore, Singapore
Designing high-performing heuristics for vehicle routing problems (VRPs) is a complex task that requires both intuition and deep domain knowledge. Large language model (LLM)-based code generation has recently shown promise across many domains, but it still falls short of producing heuristics that rival those crafted by human experts. In this paper, we propose VRPAgent, a framework for VRPs that integrates LLM-generated components into a metaheuristic and refines them through a novel genetic search. By using the LLM to generate problem-specific operators, embedded within a shared metaheuristic framework for VRPs, VRPAgent keeps tasks manageable, guarantees correctness, and still enables the discovery of novel and powerful strategies. Across multiple VRPs, including the capacitated VRP, the VRP with time windows, and the prize-collecting VRP, our method discovers heuristic operators that outperform handcrafted methods and recent learning-based approaches while requiring only a single CPU core. To our knowledge, VRPAgent is one of the first LLM-based methods to advance the state-of-the-art in VRPs, highlighting a promising future for automated heuristics discovery.
André Hottung, Federico Berto, Chuanbo Hua +9
Bielefeld University · Radical Numerics · KAIST +6
Large language models (LLMs) can generate executable solver code from natural-language descriptions of optimization problems. However, existing verification signals focus on whether the generated formulation produces the correct objective value. Such signals can overlook constraint-level errors: incorrect formulations may still produce the same optimum when extra or missing constraints do not affect the tested instance. We propose constraint injection, a verification method that directly tests whether the generated code implements the intended constraints. We use feasible solutions to detect incorrectly added constraints and one-constraint-violating solutions to detect omissions. Together with the optimal value check, these tests verify both the objective and the constraint set. We evaluate this approach on vehicle routing problems (VRPs), which provide a challenging testbed with diverse, tightly coupled operational constraints. We develop VRPCoder, an 8B model for generating Gurobi code from natural-language VRP descriptions, and VRPBench, an expert-verified benchmark spanning 21 VRP variants across four subsets. The verifier serves as a rejection-sampling criterion for synthetic data construction and as a rollout-level reward for reinforcement learning (RL). On VRPBench, VRPCoder-RL reaches 93% overall Pass@1, outperforms Gemini-3.1-Pro Preview on three subsets, exceeds Claude-Sonnet-4.5 by 28 percentage points, and exceeds the strongest prior OR-LLM by 78 percentage points.
Xizi Luo, Changhong He, Dongdong Geng +2
Beihang University, Beijing, China · Baidu Inc., Beijing, China