Manuscript Offprint
arXiv:2610.21393Self-Guided LLM Reasoning for Error Diagnosis in Vehicle Routing Problems
Abstract
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.
1 Introduction
Vehicle Routing Problems (VRPs) are widely deployed in real-world decision-making pipelines across last-mile delivery (Tiwari and Sharma 2023; Tilk, Olkis, and Irnich 2021; Kitjacharoenchai and Lee 2019), transportation (Gayialis, Konstantakopoulos, and Tatsiopoulos 2019; Wang et al. 2024; Xu et al. 2023), and ride-sharing (Lin et al. 2012; Guo et al. 2022; Chen et al. 2019). While decades of research have produced highly efficient optimization algorithms, the reliability of these pipelines remains fragile: subtle inconsistencies or latent errors in problem instances can lead to solver failures or infeasible solutions. Most VRP solvers assume that input instances are well-formed and feasible. In practice, however, instances may contain errors such as formatting issues, missing fields, or violated feasibility constraints. Importantly, many of these faults are latent as they are not immediately evident from the instance specification and require additional analysis to be identified. Given the diversity of VRP formulations and input formats across problem settings, designing general-purpose programs for automatic error detection is highly challenging. As a result, prior approaches typically rely on domain expertise or post hoc analysis of solver outputs to infer potential instance-level issues, which is both time-consuming and expertise-dependent.
Recent advances in large language models (LLMs) offer a promising new direction. With strong language understanding and reasoning capabilities, LLMs can interpret diverse inputs and reason about structured information. These capabilities naturally prompt following questions: a) Can LLMs be enabled to identify and correct errors in VRP instances? b) How and why does such reasoning succeed or fail? c) Under what conditions do LLMs struggle to identify errors, and how can these limitations be effectively mitigated?
Recent work has begun to explore this direction. For example, MOID (Li et al. 2025) attempts to identify potential instance-level issues by examining the feasibility of solutions produced by a solver. However, it heavily relies on solver outputs and thus inherits their limitations, since infeasible solutions may arise from solver deficiencies rather than errors in the input instance. Moreover, a comprehensive evaluation of LLMs' capability to directly identify and correct errors within VRP instances remains absent to date.
In this paper, we systematically investigate the capability of LLMs to diagnose errors in VRP instances. To address the aforementioned research questions, we evaluate: (i) LLMs' ability to handle increased error complexity, (ii) their ability to cope with increased instance complexity, and (iii) the effect of iterative reasoning on error detection performance. Our findings show that (i) LLMs perform well in detecting formatting errors and relatively simple constraint violations, such as capacity and demand constraints. However, their ability to identify more complex constraint violations, including time windows and distance limits, as well as scenarios with larger numbers of errors, is substantially weaker. (ii) Detection performance degrades as instance scale and constraint counts increases, indicating limited robustness under increased instance complexity. (iii) While iterative reasoning improves the detection of formatting issues and simple constraint violations, it provides limited benefit for identifying more complex errors.
In summary, we find that LLMs are effective at identifying and correcting errors in relatively simple settings, whereas their performance degrades when confronted with instances or errors of higher complexity. To address limitations, we propose a self-guided reasoning framework in which the LLM generates analysis code as an intermediate reasoning tool. This code enables the model to extract structured insights that facilitate error detection while alleviating overall reasoning burden. Our contributions are summarized as follows:
• We present a comprehensive study of LLMs’ capability to detect errors in VRP instances, including a systematic analysis of how error complexity, instance complexity and reasoning depth affect detection performance.
-
We propose a self-guided reasoning framework in which LLMs generate code to derive intermediate reasoning insights, addressing their limitations in handling complex errors while reducing the overall reasoning burden.
-
Extensive experiments across diverse problem settings, including vehicle routing and bin packing, demonstrate that our framework significantly enhances error detection performance, achieving near-perfect accuracy.
However, all of these methods assume that input instances are feasible and error-free, and therefore lack the capability to handle instance-level errors that frequently arise in practice. MOID (Li et al. 2025) takes a step toward error detection by analyzing solver execution, but its reliance on potentially unreliable solvers makes it difficult to distinguish between instance-level errors and solver-induced failures. As such, it serves as an initial attempt rather than a comprehensive solution. In this work, we bridge this gap by enabling LLMs to directly identify and reason about instance-level errors.
3 A Comprehensive Study
In this section, we conduct a comprehensive study on LLMs' capability to detect error in VRP instances, examining performance across varying levels of error complexity, instance complexity, and reasoning depth. To enable a systematic evaluation, we construct error-injected VRP datasets by introducing 200 errors into 20 instances for each VRP variant. These errors include both formatting errors (e.g., value errors or missing entries) and feasibility-related errors (e.g., constraint violation). Detailed descriptions are provided in Appendix B.

| Variant | Format | Capacity | Backhaul | Distance Limit | Time Window |
|---|---|---|---|---|---|
| CVRP | 91.38 | 84.28 | - | - | - |
| OCVRP | 90.32 | 92.38 | - | - | - |
| MDCVRP | 94.44 | 87.67 | - | - | - |
| CVRPB | 98.90 | - | 61.19 | - | - |
| CVRPMB | 91.18 | - | 64.29 | - | - |
| CVRPTW | 95.38 | 90.00 | - | - | 0.00 |
| CVRPL | 97.53 | 82.97 | - | 0.00 | - |
Figure 1: Overall error detection performance across different VRP variants, with a breakdown by error type shown below (higher is better).
3.1 Error Complexity
We analyze LLMs' ability to handle varying levels of error complexity, including constraint violations across different problem variants and varying numbers of errors.
Problem Variant. We analyze error detection performance across 7 simple VRP variants, each containing one or two types of constraints. As shown in Fig. 1, LLMs achieve consistently high detection rates for formatting errors and faults associated with simple constraints (e.g., capacity (C)), indicated by the red bars. These results suggest that LLMs are effective at identifying errors that can be detected through basic inspection or straightforward logical checks.
However, detection rates degrade substantially as constraint complexity increases. For variants involving backhaul (B) constraints, accuracy declines noticeably. For more complex constraints, such as time windows (TW) and distance limits (L), detection rates drop sharply and approach zero. This highlights a key limitation: while LLMs perform well on formatting errors and simple constraint violations, they struggle with errors that require complex calculations or numerical reasoning.
Error Number. We further evaluate the impact of error number on LLM-based error detection by varying the number of injected errors and measuring detection performance across different VRP variants. To provide a more comprehensive assessment of its impact, we select variants with increasing constraint complexity, ranging from CVRP, which involves a single type of constraint, to MDOCVRPMBLTW, which incorporates six types of constraints.
Fig. 2 shows that detection performance consistently declines as the number of injected errors increases across all variants. This trend holds regardless of the underlying prob-

Figure 2: Effect of fault number and instance scale.
lem type, indicating that LLMs are highly sensitive to the accumulation of errors within an instance. These results suggest that a larger number of errors imposes a substantially greater reasoning burden on LLMs, as they must simultaneously identify more errors.
3.2 Instance Complexity
Beyond error complexity, intrinsic instance complexity may also impact LLMs' ability to detect errors. To study this, we conduct experiments across varying instance scales and constraint counts.
Instance Scale. We examine the effect of instance scale on error detection performance by comparing instances of different sizes. As shown in Fig. 2, detection rates on 100-node instances are uniformly lower than those on 50-node instances across all VRP variants and error settings. This performance degradation indicates that larger instance significantly increase the complexity of instance-level reasoning. As the number of nodes grows, LLMs reason over a larger set of constraints and dependency relationships, which exacerbates the reasoning burden and makes accurate error identification increasingly difficult.
Count of Constraint Type. We evaluate LLM-based error detection across 48 VRP variants with constraint counts ranging from one to six, and report the average detection rate for each constraint level. As shown in Table 1, error detection performance exhibits a clear decreasing trend as the number of constraints types increases. While LLMs achieve relatively high detection accuracy when only one or two constraint types are present, performance degrades substantially as more constraint types are introduced, with a sharp drop observed for instances involving five or six constraint types. These results indicate that an increasing number of constraint types significantly challenges LLMs' ability to identify errors, highlighting a key limitation of direct LLM-based error detection in highly constrained VRPs.

Figure 3: Effect of reasoning depth on error detection performance across different VRP variants.
Table 1: Average error detection rates of LLMs under different numbers of constraint types. (higher is better).
| Constraint Type | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| LLM (%) | 87.27 | 79.42 | 72.42 | 57.42 | 53.97 | 22.30 |
3.3 Reasoning Depth
Iterative reasoning is an effective approach to improve error detection. To evaluate its impact, we analyze the role of reasoning depth through an iterative process, in which the LLM identifies errors, the instance is repaired accordingly, and the LLM then reasons again on the updated version. As shown in Fig. 3, increasing reasoning depth consistently improves detection rates across VRP variants. For variants with relatively simple constraints (e.g., CVRP and CVRPB), repeated reasoning yields performance gains, with detection rates approaching after several iterations.
However, for problems with more complex constraints, the benefits of deeper reasoning diminish. In particular, for instances with constraints such as time windows and combinations of multiple constraints, detection performance remains far from perfect. These results suggest that while iterative reasoning can facilitate error detection by LLMs, it remains insufficient for handling complex errors, such as violations involving intricate constraints or combinations of constraints that require sophisticated feasibility reasoning.
4 Self-Guided Reasoning Framework
Our analysis of LLMs' ability to detect instance-level errors reveals a key limitation: their difficulty in handling instances or errors of higher complexity which may require advanced reasoning. To address this, we propose a self-guided reasoning framework in which the LLM first constructs a reasoning

(a) Instance Analysis
(b) Insight Generation
(c) Report Generation
Figure 4: Overall framework of Self-Guided Reasoning.
chain for error detection and then uses it to guide the generation of analysis code. The generated code yields structured insights that the LLM can reference, enhancing its ability to identify errors while alleviating the overall reasoning burden.
As illustrated in Fig. 4, the framework begins with instance analysis, where the LLM analyzes the input instance by identifying the problem type, required section names, and associated constraints. Based on this analysis, the LLM derives a reasoning path that outlines how to analyze potential errors in the instance and generates corresponding function-level prompts for each step. Guided by these prompts, executable code is generated and run to extract relevant insights. Finally, using both the original instance and the extracted insights as references, the LLM produces a final report.
4.1 Instance Analysis
Given an input instance, the instance analysis stage aims to establish a concise and structured understanding of the problem specification. The LLM first parses the raw instance to identify its essential characteristics, which are summarized as follows:
• Problem type, indicating the underlying optimization problem (e.g., CVRP) implied by the instance.
• Required section names, specifying the mandatory sections that a valid instance of the identified problem type should contain.
• Associated constraints, describing the feasibility conditions in the identified problem, such as capacity, time window and so on.
Based on this structured information, the LLM performs a self-validation step to identify potential inconsistencies among the problem type, required sections, associated constraints, and the instance content, and revises its analysis accordingly. Finally, the LLM produces an instance analysis summary, providing an intuitive and reliable reference that helps reduce the reasoning burden in subsequent stages. The detailed prompt used for instance analysis is provided in Appendix D.1.
4.2 Insight Generation
The framework then proceeds to the insight generation stage, where the LLM derives structured insights for error analysis. A detailed example of the prompt used at this stage is provided in Appendix D.2. Based on the previously generated instance analysis summary, the LLM infers which parts of the instance are likely to contain errors. More specifically, it reasons about the potential locations of formatting errors, such as missing sections or invalid values, as well as feasibility errors, such as capacity violations, and then specifies a corresponding reasoning path.
Following this reasoning path, the LLM generates a set of function-level prompts, each corresponding to a specific analysis step. These prompts clearly describe the intended functionality, required inputs, and expected outputs, and are used to guide code generation. During this process, the LLM is instructed to ensure that the generated code reports detailed diagnostic information at the point of error detection, allowing for precise localization and subsequent revision.
The generated code is then executed to perform structured instance analysis and extract concrete evidence of potential errors. If execution failures or runtime bugs occur, the resulting bug messages are fed back to the LLM, which revises the code accordingly. Once execution succeeds, the analysis outputs are collected and summarized as error insights, which form the basis for subsequent reporting and decision-making.
Overall, in this stage, the LLM guides code generation to convert its reasoning into executable procedures. This design offers two key advantages: (i) complex constraint calculations are offloaded to code execution, addressing the limitations of LLMs in precise numerical reasoning; and (ii) programmatic analysis enables both efficient and comprehensive evaluation of the instance, substantially reducing the reasoning burden on the LLM.
4.3 Report Generation
In the final stage, the framework performs report generation by synthesizing the derived insights with the original
Table 2: Error Detection Rate (EDR) comparison across 48 VRP variants (higher is better).
| EDR(%) | Time(m) | EDR(%) | Time(m) | EDR(%) | Time(m) | EDR(%) | Time(m) | EDR(%) | Time(m) | EDR(%) | Time(m) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| LLM | CVRP | OCVRP | CVRPTW | CVRPL | MDCVRP | CVRPB | ||||||
| 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 |
| LLM | CVRPMB | OCVRPTW | MDOCVRP | OCVRPB | CVRPLTW | MDCVRPL | ||||||
| 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 |
| LLM | CVRPBL | CVRPBTW | MDCVRPTW | MDCVRPB | OCVRPMB | CVRPMBL | ||||||
| 56.50 | 7.04 | 64.00 | 13.96 | 76.00 | 15.48 | 71.50 | 10.57 | 86.00 | 9.27 | 65.00 | 7.63 | |
| Self-Guided | 100.00 | 8.10 | 95.00 | 12.36 | 95.50 | 17.29 | 95.50 | 11.35 | 95.00 | 10.55 | 91.50 | 7.93 |
| LLM | OCVRPL | CVRPMBTW | MDCVRPMB | MDCVRPMBL | CVRPMBLTW | MDCVRPBTW | ||||||
| 75.25 | 7.90 | 64.00 | 10.46 | 78.00 | 8.64 | 44.50 | 9.55 | 61.39 | 12.43 | 51.00 | 12.50 | |
| Self-Guided | 99.50 | 7.38 | 96.50 | 11.95 | 96.00 | 8.88 | 96.65 | 11.22 | 98.51 | 12.17 | 90.50 | 13.08 |
| LLM | OCVRPLTW | MDOCVRPL | OCVRPBL | OCVRPMBL | MDOCVRPTW | OCVRPBTW | ||||||
| 56.59 | 10.87 | 43.69 | 7.68 | 62.00 | 7.95 | 63.00 | 8.63 | 68.50 | 13.25 | 71.50 | 9.60 | |
| Self-Guided | 96.10 | 12.95 | 93.00 | 8.97 | 96.50 | 8.56 | 94.50 | 9.56 | 98.50 | 14.12 | 94.00 | 11.20 |
| LLM | OCVRPMBTW | MDOCVRPB | MDOCVRPMB | MDCVRPLTW | MDCVRPBL | CVRPBLTW | ||||||
| 60.00 | 11.83 | 86.50 | 10.28 | 67.50 | 9.66 | 23.08 | 11.32 | 44.00 | 8.37 | 56.00 | 13.32 | |
| Self-Guided | 99.50 | 13.35 | 92.00 | 9.73 | 97.00 | 8.80 | 98.56 | 12.38 | 90.00 | 10.62 | 96.59 | 13.80 |
| LLM | MDVRPMBTW | MDOVRPLTW | OCVRPBLTW | OCVRPMBLTW | MDOCVRPBTW | MDOCVRPMBTW | ||||||
| 59.50 | 14.42 | 43.75 | 8.50 | 56.96 | 10.10 | 66.07 | 10.28 | 60.00 | 10.53 | 62.50 | 12.64 | |
| Self-Guided | 90.00 | 15.20 | 96.67 | 9.83 | 97.83 | 11.22 | 98.55 | 12.53 | 94.50 | 11.27 | 99.00 | 12.04 |
| LLM | MDOCVRPBL | MDOCVRPMBL | MDCVRPBLTW | MDCVRPMBLTW | MDOCVRPBLTW | MDOCVRPMBLTW | ||||||
| 42.45 | 9.95 | 60.00 | 8.12 | 31.02 | 9.78 | 61.95 | 12.39 | 14.03 | 13.53 | 30.56 | 13.13 | |
| Self-Guided | 100.00 | 10.78 | 99.52 | 10.23 | 98.61 | 12.43 | 100.00 | 11.60 | 99.10 | 15.28 | 98.46 | 14.52 |
instance information. Guided by the extracted error insights, the LLM systematically aligns the identified errors with the corresponding components of the input instance. This enables the generation of a comprehensive and structured report that clearly outlines the types, locations, and potential causes of the detected errors. Based on this report, the LLM is further instructed to revise the instance accordingly, correcting the identified errors to obtain a valid and consistent instance specification. The prompt used for this stage is provided in Appendix D.3.
5 Experiment
To evaluate the effectiveness of the proposed self-guided framework, we compare it against LLM across 48 VRP variants. Then we conduct a comprehensive analysis along multiple dimensions, including reasoning depth, error number, instance scale, and constraint complexity, to assess the performance improvements introduced by our framework. Furthermore, we provide comparisons with several prompting strategies to further validate the advantages of our approach. Finally, we extend our evaluation to other combinatorial optimization problems and LLMs to demonstrate the generality of the proposed framework.
To provide a more complete understanding of the framework's behavior, additional analyses are presented in the appendix, including false positive analysis on valid instances (Appendix C.2), comparison of error detection accuracy on instance-level (Appendix C.3), and downstream solver validation on repaired instances (Appendix C.4). And details on hyperparameters and the experimental setup are provided in Appendix C.1.
5.1 Comparison of Error Detection Rate
We conduct experiments on 48 VRP variants to assess error detection performance. The comparison of Error Detection Rate (EDR) is reported in Table 2. As shown by these results, directly applying LLMs exhibits limited error detection capability on many variants, especially those involving multiple constraints or complex combinations, where the EDR often falls below and in some cases even below .
By contrast, the proposed self-guide approach consistently achieves improvements in error detection performance across all variants. In the most cases, self-guide raises the EDR to above , and frequently reaches near-perfect detection rates, demonstrating its robustness under diverse problem settings and constraint combinations. Importantly, these performance gains are obtained without introducing significant additional computational overhead. As shown by the time statistics, self-guide only incurs a marginal increase in runtime compared with direct LLM inference, while delivering dramatically higher error detection accuracy.
Table 3: Impact of instance scale and fault number on EDR for LLM and the Self-Guided framework.
| 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 |
| CVRPMBL | 70.05 | 99.00 | 65.00 | 91.50 | 47.52 | 88.37 | 67.74 | 100.00 | 60.34 | 93.50 | 45.97 | 87.58 |
| MDCVRPMBTW | 70.00 | 92.00 | 59.50 | 90.00 | 54.67 | 88.33 | 69.00 | 98.00 | 56.50 | 91.00 | 52.67 | 87.67 |
| MDOCVRPBTW | 66.00 | 96.00 | 60.00 | 94.50 | 49.67 | 86.67 | 58.00 | 100.00 | 55.50 | 95.50 | 48.33 | 94.66 |
| MDOCVRPMBLTW | 72.59 | 98.56 | 69.44 | 98.46 | 44.67 | 96.00 | 54.98 | 97.26 | 44.46 | 97.85 | 39.87 | 96.46 |
Table 4: Impact of Reasoning Depth on EDR for LLM and the Self-Guided Framework
| Reasoning Depth EDR(%) | LLM | 1 Self-Guided | LLM | 2 Self-Guided | LLM | 3 Self-Guided | LLM | 4 Self-Guided | LLM | 5 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 |
| MDCVRPMBTW | 59.50 | 90.00 | 60.00 | 99.00 | 60.00 | 99.50 | 61.00 | 100.00 | 65.50 | 100.00 |
| MDOCVRPBTW | 60.00 | 94.50 | 61.50 | 98.50 | 62.00 | 99.00 | 62.50 | 99.00 | 64.00 | 100.00 |
| MDOCVRPMBLTW | 30.56 | 98.46 | 31.00 | 99.54 | 34.93 | 100.00 | 35.26 | 100.00 | 36.24 | 100.00 |
5.2 Performance Analysis
Impact of Error Number. Table 3 shows that increasing the number of injected errors significantly degrades the error detection performance of direct LLM inference, especially for instances with complex constraints such as CVRPMBL and MDOCVRPMBLTW. In contrast, the self-guided framework remains robust to error number variations, consistently achieving substantially higher EDR and often maintaining over detection accuracy even when the error number reaches 15.
Impact of Instance Scale. The impact of instance scale is also evident from Table 3. When moving from 50-node to 100-node instances, the error detection performance of direct LLM inference generally deteriorates, especially under larger error numbers. This performance drop highlights the difficulty of handling larger problem instances with more complex interactions using pure LLM-based reasoning. In contrast, the self-guided framework exhibits much better scalability. While instance scale increases the overall difficulty of the task, self-guided framework maintains consistently high EDR across most variants, with only moderate performance degradation in the most challenging settings. This demonstrates that the proposed framework scales more effectively with instance size, enabling robust error detection even on larger and more complex VRP instances.
Effect of Reasoning Depth. Table 4 reports the impact of reasoning depth on error detection performance for both direct LLM inference and the proposed self-guided framework. As the reasoning depth increases, direct LLM inference shows only limited and gradual improvements, and fails to consistently achieve perfect error detection across different VRP variants. In contrast, the self-guided framework exhibits clear and stable convergence behavior. Under our framework, a reasoning depth of five is sufficient to guarantee a error detection rate across all evaluated VRP variants.
A detailed analysis of the impact of constraints type count is provided in Appendix C.5.
5.3 Comparison with Prompt Strategies
To demonstrate the advantage of self-guided framework, we compare it with self-refine (Madaan et al. 2023), critic-guided refinement (Bai et al. 2022) and COT (Wei et al. 2022). All methods are evaluated under the same experimental settings to ensure a fair comparison.
As shown in Table 5, while Self-Refine, critic-guided refinement, and CoT consistently improve upon direct LLM inference, their gains remain limited across complex VRP variants. In contrast, the self-guided framework achieves substantially higher EDR across all tested instances, particularly on more challenging variants. Moreover, this performance improvement is obtained with only modestly increased runtime, demonstrating that the self-guided framework offers a more effective and robust solution for error detection.
5.4 Evaluation on Other Combinatorial Optimization Problems
We additionally apply our framework to the Bin Packing Problem (BPP). BPP is a classical combinatorial optimiza-
Table 5: Comparison with Different Prompt Strategies.
| 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 |
| MDCVRPMBTW | 59.50 | 14.42 | 65.50 | 12.60 | 60.00 | 14.73 | 62.00 | 9.05 | 90.00 | 15.20 |
| MDOCVRPBTW | 60.00 | 10.53 | 62.00 | 11.61 | 61.50 | 14.96 | 60.50 | 9.83 | 94.50 | 11.27 |
| MDOCVRPMBLTW | 30.56 | 10.13 | 34.89 | 13.20 | 31.88 | 16.00 | 33.18 | 9.15 | 98.46 | 14.52 |
Table 6: EDR and Runtime on Bin Packing Problems.
| 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 |
tion problem that aims to pack a set of items into the minimum number of bins subject to capacity constraints. In the one-dimensional setting (1D BPP), each item is characterized by a single size, whereas in the two-dimensional setting (2D BPP), items have both width and height, introducing additional geometric constraints and increasing problem complexity.
As shown in Table 6, the proposed self-guided framework consistently outperforms direct LLM inference on both 1D and 2D BPP. While the LLM already achieves relatively high error detection rates, our framework further improves performance, reaching on 1D BPP and on 2D BPP. These improvements are obtained with only a marginal increase in runtime, demonstrating that the self-guided framework can effectively extend to other combinatorial optimization problems.
5.5 Application to Other LLMs
Table 7: Comparison across different LLMs with and without the Self-Guided framework on EDR (%).
| 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 |
| MDCVRPMBTW | 59.50 | 90.00 | 55.00 | 88.50 | 61.00 | 92.00 |
| MDOCVRPBTW | 60.00 | 94.50 | 58.50 | 93.50 | 61.50 | 95.00 |
| MDOCVRPMBLTW | 30.56 | 98.46 | 26.85 | 94.45 | 34.07 | 99.54 |
We further evaluate the proposed self-guided framework on GPT-4o (OpenAI 2024) and Claude Opus 4 (Anthropic 2025) to assess its generality across LLM backends. As shown in Table 7, direct inference degrades substantially on complex VRP variants across GPT-4.1, GPT-4o, and Claude Opus 4, especially under multiple coupled constraints and long-horizon reasoning, suggesting that this limitation is not model-specific.
In contrast, the proposed self-guided framework consistently yields substantial improvements in EDR across all models and problem variants. Notably, even on the most challenging instances, self-guided inference raises the EDR to above in most cases, demonstrating stable gains across different LLM families. These results suggest that the proposed framework is largely model-agnostic and can effectively enhance error detection reliability regardless of the underlying LLM backbone.
6 Conclusion
In this work, we investigate error detection in vehicle routing problem instances and identifies fundamental limitations of large language models (LLMs) when confronted with instances or errors of higher complexity. To address these challenges, we introduce a self-guided reasoning framework that enables LLMs to generate reasoning paths to guide code generation and produce additional insights, thus enhancing their own reasoning capabilities. Extensive experiments across diverse problem settings and LLM backbones demonstrate that the proposed approach consistently and substantially improves error detection performance, achieving near-perfect accuracy and underscoring its effectiveness and generality.
Despite its effectiveness, the proposed self-guided framework has certain limitations. While we evaluate the framework on a wide range of COPs and LLM backbones, further validation on additional problem domains and real-world noisy datasets would be valuable to fully assess its generalization. Moreover, some errors in problem instances may interfere with the detection of other errors; for example, missing or malformed sections can obscure subsequent error detection. Although our framework alleviates this issue through iterative reasoning, such cascading effects cannot be entirely eliminated in the initial reasoning round.
References
Anthropic. 2025. Introducing Claude 4. https://www.anthropic.com/news/claude-4. Accessed: 2026-01-05.
Bai, Y.; Kadavath, S.; Kundu, S.; Askell, A.; Kernion, J.; Jones, A.; Chen, A.; Goldie, A.; Mirhoseini, A.; McKinnon, C.; et al. 2022. Constitutional ai: Harmlessness from ai feedback. arXiv preprint arXiv:2212.08073.
Berto, F.; Hua, C.; Zepeda, N. G.; Hottung, A.; Wouda, N.; Lan, L.; Park, J.; Tierney, K.; and Park, J. 2025. RouteFinder: Towards Foundation Models for Vehicle Routing Problems. Transactions on Machine Learning Research.
Chen, W.; Mes, M.; Schutten, M.; and Quint, J. 2019. A ride-sharing problem with meeting points and return restrictions. Transportation science, 53(2): 401–426.
Dat, P. V. T.; Doan, L.; and Binh, H. T. T. 2025. HSEvo: Elevating automatic heuristic design with diversity-driven harmony search and genetic algorithm using llms. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, 26931–26938.
Gayialis, S. P.; Konstantakopoulos, G. D.; and Tatsiopoulos, I. P. 2019. Vehicle routing problem for urban freight transportation: A review of the recent literature. Operational research in the digital era–ICT challenges, 89–104.
Guo, J.; Long, J.; Xu, X.; Yu, M.; and Yuan, K. 2022. The vehicle routing problem of intercity ride-sharing between two cities. Transportation Research Part B: Methodological, 158: 113–139.
Jiang, X.; Wu, Y.; Li, M.; Cao, Z.; and Zhang, Y. 2025. Large Language Models as End-to-end Combinatorial Optimization Solvers. In The Thirty-ninth Annual Conference on Neural Information Processing Systems.
Kitjacharoenchai, P.; and Lee, S. 2019. Vehicle routing problem with drones for last mile delivery. Procedia Manufacturing, 39: 314–324.
Li, K.; Zheng, R.; Hao, X.; and Wang, Z. 2025. Multi-objective infeasibility diagnosis for routing problems using large language models. arXiv preprint arXiv:2508.03406.
Lin, Y.; Li, W.; Qiu, F.; and Xu, H. 2012. Research on optimization of vehicle routing problem for ride-sharing taxi. Procedia-Social and Behavioral Sciences, 43: 494–502.
Liu, F.; Tong, X.; Yuan, M.; Lin, X.; Luo, F.; Wang, Z.; Lu, Z.; and Zhang, Q. 2024a. Evolution of Heuristics: Towards Efficient Automatic Algorithm Design Using Large Language Model. In 41st International Conference on Machine Learning (ICML 2024), 32201–32223. ML Research Press.
Liu, S.; Chen, C.; Qu, X.; Tang, K.; and Ong, Y.-S. 2024b. Large language models as evolutionary optimizers. In 2024 IEEE Congress on Evolutionary Computation (CEC), 1–8. IEEE.
Madaan, A.; Tandon, N.; Gupta, P.; Hallinan, S.; Gao, L.; Wiegreffe, S.; Alon, U.; Dziri, N.; Prabhumoye, S.; Yang, Y.; et al. 2023. Self-refine: Iterative refinement with self-feedback. Advances in Neural Information Processing Systems, 36: 46534–46594.
OpenAI. 2023. GPT-4 Technical Report. arXiv preprint arXiv:2303.08774.
OpenAI. 2024. Hello GPT-4o. https://openai.com/index/hello-gpt-4o/. Accessed: 2026-01-05.
Romera-Paredes, B.; Barekatain, M.; Novikov, A.; Balog, M.; Kumar, M. P.; Dupont, E.; Ruiz, F. J.; Ellenberg, J. S.; Wang, P.; Fawzi, O.; et al. 2024. Mathematical discoveries from program search with large language models. Nature, 625(7995): 468–475.
Tilk, C.; Olkis, K.; and Irnich, S. 2021. The last-mile vehicle routing problem with delivery options. Or Spectrum, 43(4): 877–904.
Tiwari, K. V.; and Sharma, S. K. 2023. An optimization model for vehicle routing problem in last-mile delivery. Expert Systems with Applications, 222: 119789.
Wang, Q.; Kong, L.; Xu, J.; Zhou, B.; Liu, X.; Lin, Z.; Shi, S.; Zhang, X.; and Li, L. 2024. Dual-driven interfaces of a CoP/CoO cocatalyst on a host photocatalyst for rapid charge transport in solar-driven H2 evolution. ACS Sustainable Chemistry & Engineering, 12(31): 11717–11727.
Wei, J.; Wang, X.; Schuurmans, D.; Bosma, M.; Xia, F.; Chi, E.; Le, Q. V.; Zhou, D.; et al. 2022. Chain-of-thought prompting elicits reasoning in large language models. Advances in neural information processing systems, 35: 24824–24837.
Xu, D.; Liu, S.; Zhang, M.; Xu, L.; Gao, H.; and Yao, J. 2023. Manipulating the Dynamic Self-Reconstruction of CoP Electrocatalyst Driven by Charge Transport and Ion Leaching. Small, 19(33): 2300201.
Yang, C.; Wang, X.; Lu, Y.; Liu, H.; Le, Q. V.; Zhou, D.; and Chen, X. 2024. Large Language Models as Optimizers. In International Conference on Learning Representations.
Ye, H.; Wang, J.; Cao, Z.; Berto, F.; Hua, C.; Kim, H.; Park, J.; and Song, G. 2024. ReEvo: Large language models as hyper-heuristics with reflective evolution. Advances in neural information processing systems, 37: 43571–43608.
Zhang, N.; Cao, Z.; Zhou, J.; Zhang, C.; and Ong, Y.-S. 2025. An Agentic Framework with LLMs for Solving Complex Vehicle Routing Problems. arXiv preprint arXiv:2510.16701.
A Vehicle Routing Problems
Vehicle Routing Problems (VRPs) are a fundamental class of combinatorial optimization problems (COPs) that aim to design a set of vehicle routes to serve a collection of customers while minimizing a given objective, typically the total travel distance or cost. In a standard VRP setting, all routes start and end at a depot, each customer must be visited exactly once, and various operational constraints must be satisfied. Due to the rich combination of complex constraints and diverse real-world application scenarios, VRPs are commonly used as a representative benchmark for COPs.
Several constraints are commonly studied in VRPs, including capacity, open route, and multi-depot. The details of these constraints are summarized in Table 8, and the relationships between constraints and VRP variants are illustrated in Table 9.
Table 8: Summary of VRP constraints considered in this work.
| 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. |
| MD | Multi-depot constraint, which allows vehicles to start from multiple depots rather than a single centralized one. |
B Dataset
B.1 Assumption
We construct our error detection dataset based on benchmark instances from the Route Finder dataset (Berto et al. 2025). To evaluate the capability of LLMs in identifying instance-level errors, we systematically inject synthetic errors into valid VRP instances. To ensure that each faulty instance admits a unique and unambiguous interpretation, we impose several assumptions during dataset construction, as described below.
a) Capacity and Distance Limit Correctness. Capacity values and distance limits are assumed to be correct and are not subject to corruption. This assumption enables us to disambiguate between potential error sources, such as distinguishing demand-related errors from capacity violations, and separating node coordinate errors from distance limit misconfigurations.
b) Single Error Per Node. At most one error is injected per node. For example, if a node is assigned missing or invalid coordinates, no additional errors are introduced for that node. This constraint prevents overlapping errors that could lead to ambiguous error attribution.
c) Depot Error Exclusion. When distance limit or time window errors are present, no errors are injected at the depot. This restriction is imposed because depot errors would interfere with the computation of these constraints.
These assumptions enable controlled error injection while avoiding cascading or interacting errors, facilitating a reliable and interpretable evaluation of error detection performance.
B.2 Format Errors
(i) Value Error. Value errors refer to numerical values that violate basic validity constraints, such as identifiers being out of range or numerical fields taking negative values where only non-negative values are permitted. For example, a customer ID exceeding the defined index range or a negative demand value constitutes a value error in the CVRP dataset.
(ii) Value Missing. Value missing errors occur when required numerical fields are absent in an instance. Typical examples include missing demand values, service times, or coordinates for a customer node.
(iii) Section Missing. Section missing errors arise when the name of a required section in the instance description is absent, even though the corresponding data entries may still be present.
(vi) Duplicate Node. Duplicate node errors occur when the same node appears multiple times in an instance.
B.3 Feasibility Errors
(i) Capacity (C). This constraint is associated with exceed capacity errors, which occur when the total demand assigned to a vehicle exceeds its capacity limit. For LLMs, detecting such errors mainly requires a straightforward comparison between the demand and the capacity value. As a result, this error type is relatively easy to identify, and LLMs typically achieve high detection accuracy.
(ii) Backhaul (B) and Mixed Backhaul (MB). For backhaul and mixed backhaul constraints, customer demands may take positive (linehaul) or negative (backhaul) values, and feasibility requires that the absolute value of the accumulated demand along a route does not exceed the vehicle capacity. Compared with the standard capacity constraint, error detection under these settings involves an additional absolute-value operation, which slightly increases the reasoning difficulty and results in lower detection accuracy.
(iii) Distance Limit (L). For the distance limit constraint, we compute the maximum round-trip distance between the depot and all customer nodes, and subtract a small margin (0.1) to obtain the distance limit value. We then check whether the round-trip distance of each node to the depot falls within this limit and record related violations.
Table 9: VRP variants and their associated constraints.
| 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 | ✓ | ✓ | ✓ | ||||
| OCVRPB | ✓ | ✓ | ✓ | ||||
| OCVRPL | ✓ | ✓ | ✓ | ||||
| CVRPBL | ✓ | ✓ | ✓ | ||||
| CVRPBTW | ✓ | ✓ | ✓ | ||||
| CVRPLTW | ✓ | ✓ | ✓ | ||||
| OCVRPBL | ✓ | ✓ | ✓ | ✓ | |||
| OCVRPBTW | ✓ | ✓ | ✓ | ✓ | |||
| OCVRPLTW | ✓ | ✓ | ✓ | ✓ | |||
| CVRPBLTW | ✓ | ✓ | ✓ | ✓ | |||
| OCVRPBLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| CVRPMB | ✓ | ✓ | ✓ | ||||
| OCVRPMB | ✓ | ✓ | ✓ | ✓ | |||
| CVRPMBL | ✓ | ✓ | ✓ | ✓ | |||
| CVRPMBTW | ✓ | ✓ | ✓ | ✓ | |||
| OCVRPMBL | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| OCVRPMBTW | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| CVRPMBLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| OCVRPMBLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| MDCVRP | ✓ | ✓ | |||||
| MDOCVRP | ✓ | ✓ | ✓ | ||||
| MDCVRPB | ✓ | ✓ | ✓ | ||||
| MDCVRPL | ✓ | ✓ | ✓ | ||||
| MDCVRPTW | ✓ | ✓ | ✓ | ||||
| MDOCVRPTW | ✓ | ✓ | ✓ | ✓ | |||
| MDOCVRPB | ✓ | ✓ | ✓ | ✓ | |||
| MDOCVRPL | ✓ | ✓ | ✓ | ✓ | |||
| MDCVRPBL | ✓ | ✓ | ✓ | ✓ | |||
| MDCVRPBTW | ✓ | ✓ | ✓ | ✓ | |||
| MDCVRPLTW | ✓ | ✓ | ✓ | ✓ | |||
| MDOCVRPBL | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| MDOCVRPBTW | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| MDOCVRPLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| MDCVRPBLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| MDOCVRPBLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| MDCVRPMB | ✓ | ✓ | ✓ | ✓ | |||
| MDOCVRPMB | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| MDCVRPMBL | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| MDCVRPMBTW | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| MDOCVRPMBL | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| MDOCVRPMBTW | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| MDCVRPMBLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| MDOCVRPMBLTW | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
(iv) Open Route (O). Under the open route constraint, vehicles are not required to return to the depot after completing their routes. Accordingly, the error injection for the distance limit constraint is modified to compute the maximum one-way distance from the depot to all customers and subtract a small margin (0.1) to define the new distance limit value and record violations.
(v) Time Window (TW). For the time window constraint, we randomly select a node that has not been assigned any error and compute its travel distance from the depot. The left bound of the time window is set to 0.7 times this distance, and the right bound is set to 0.9 times the same distance, which is designed to make the time window infeasible for that node.
(vi) Multi-Depot (MD). Under the multi-depot setting, distance-related constraints are evaluated with respect to the nearest depot. Specifically, the distance limit is computed based on the maximum round-trip distance between each node and its closest depot, rather than a single fixed depot. Similarly, when injecting time window errors, the travel distance used to construct the time window bounds is calculated with respect to the nearest depot to the selected node.
C More Experiment Details
C.1 Hyperparameters and Device.
For error detection evaluation, we adopt benchmark instances from the RouteFinder dataset (Berto et al. 2025). For each dataset consisting of 20 instances with 50 nodes, we inject up to 200 errors to construct faulty datasets. For certain datasets (e.g., CVRP), the number of injected errors is correspondingly lower due to structural constraints. All experiments are conducted using GPT-4.1 (OpenAI 2023) as the underlying LLM for error detection on a system equipped with an AMD EPYC 7702P CPU. We will make our code and data publicly available after publication. The reported data are averaged.
C.2 False Positive Analysis on Valid Instances
Table 10: Number of faults detected by LLM on correct VRP instances.
| CVRP | OCVRP | MDCVRP | CVRPB | CVRPMB | CVRPTW | CVRPL | |
|---|---|---|---|---|---|---|---|
| LLM | 2 | 1 | 0 | 11 | 13 | 4 | 0 |
| Self-Guided | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
We further evaluate the error detection behavior on correct VRP instances. As shown in Table 10, direct LLM inference may incorrectly report non-existent errors even when the input instance is valid, which results in false positives across several VRP variants. In contrast, the proposed self-guided framework does not exhibit this issue: when no errors are present in the instance, it consistently reports the instance as correct. This demonstrates that self-guided reasoning effectively reduces false alarms and improves the reliability of error detection.
C.3 Comparison of Instance-Level Error Detection Accuracy
Table 11: Percentage of instances where all faults are correctly detected.
| (%) | CVRP | OCVRP | MDCVRP | CVRPB | CVRPMB | CVRPTW | CVRPL |
|---|---|---|---|---|---|---|---|
| LLM | 65 | 85 | 85 | 55 | 75 | 10 | 5 |
| Self-Guided | 95 | 95 | 95 | 85 | 90 | 90 | 100 |
Table 11 reports the instance-level error detection accuracy, measured as the percentage of instances for which all errors are correctly identified. The results show that direct LLM inference struggles to achieve reliable instance-level correctness, especially for variants with complex constraints such as CVRPTW and CVRPL, where the accuracy drops to and , respectively. In contrast, the proposed self-guided framework consistently achieves higher instance-level accuracy across all VRP variants, with performance remaining above and reaching on CVRPL. These results demonstrate that self-guided reasoning substantially improves the reliability of error detection at the instance level, particularly in settings with complex constraints.
C.4 Downstream Solver Validation on Repaired Instances
We apply the instances revised by our framework to AFL (Zhang et al. 2025), an LLM-based solver that takes problem instances as input and is capable of handling a wide range of VRP constraints. As shown in Table 12, these revised instances can be directly used by AFL without any additional modification.
C.5 Impact of Constraint Type Counts.
Table 13: EDR under different counts of constraint types.
| 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 |
Table 13 shows that as the number of constraint types increases, the error detection rate of direct LLM inference degrades rapidly. In contrast, the self-guided framework remains highly robust to increasing constraint combination complexity, and consistently achieves over error detection across all settings. These results demonstrate that the proposed framework effectively mitigates the negative impact of complex constraint combination on error detection.
C.6 Evaluation on the Hard-Mode Dataset.
The controlled error-injection setting used in our main experiments (e.g., at most one error per node with fixed injection parameters) enables attribution-clean evaluation and avoids ambiguities caused by cascading errors. In real-world operational data, however, multiple faults may interact and produce
Table 12: Downstream solver performance on repaired VRP instances.
| 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 |
Table 14: Error Detection Rate (EDR, %) on the more challenging hard-mode dataset, where multiple errors may occur within the same node.
| 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 |
more complex failure patterns. To better reflect such scenarios, we additionally construct a more challenging hard-mode dataset, where multiple errors are allowed to occur within the same node. As shown in Table 14, the self-guided framework remains consistently more robust than direct LLM diagnosis across all evaluated VRP variants, with particularly large improvements on variants involving more complex constraints.
C.7 Error-Type-Specific False Positive Analysis.
While EDR summarizes the overall error-detection performance and incorporates localization accuracy, it does not fully characterize diagnostic reliability. In particular, a practical diagnostic system should avoid incorrectly flagging valid instances as erroneous. We therefore further evaluate error-type-specific false positives on valid instances. Table 15 reports the number of false-positive detections for each constraint type. The self-guided framework substantially suppresses spurious diagnoses, eliminating all observed false positives in these experiments. Together with the downstream evaluation of repaired instances in Appendix C.4, these results provide a more complete assessment of the reliability of the proposed framework.
D Example Prompts
D.1 Instance Analysis
Prompt 1.1 Instance Analysis
We need to solve a VRP instance. I will provide you with the instance. Please analyze it carefully.
Step 1. Identify the constraints of the instance and list them clearly in numbered format 1), 2), 3), ... within [ ]. For each constraint, write both the abbreviation (if any) and a short explanation (e.g., Capacity (C): vehicles have limited capacity). Do not include instance-specific details such as the exact number of nodes, vehicles, or capacity values.
Step 2. Write the standard problem type abbreviation (e.g., TSP, CVRP, CVRPL, VRPTW, OVRP, MDVRP), enclosed in quotation marks “”.
Step 3. List the sections that a correct and feasible instance should contain (e.g., DIMENSION, CAPACITY, if present).
Output format:
-
[constraints]
-
"specific name"
-
[sections]
Output 1.1 Instance Analysis
- [
-
Capacity (C): each vehicle has a limited carrying capacity that cannot be exceeded.
-
Visit constraint (V): each customer must be visited exactly once.
-
Depot constraint (D): all routes must start and end at the depot.
]
-
"CVRP"
-
[DIMENSION, CAPACITY, NODE_COORD_SECTION, DEMAND_SECTION, DEPOT_SECTION]
Prompt 1.2 Self-Validation
You are a VRP expert. I will give you:
-
The original .vrp file content
-
LLM's answer (constraints, specific name, and required sections)
Your task is to judge whether the answer is correct. Specifically, check consistency among:
- Constraints implicitly or explicitly specified in the .vrp file
• The specific problem name vs. the .vrp file
• The listed constraints vs. the specific problem name
Do not include any extra elements not present in the instance.
If any contradiction exists, treat the .vrp file as the ground truth and mark the answer as incorrect. If everything is consistent, mark it as correct.
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.
| 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 | - | - | - |
| Distance Limit (LLM) | - | - | - | - | - | - | 0 |
| Distance Limit (Self-guided) | - | - | - | - | - | - | 0 |
| Time Window (LLM) | - | - | - | - | - | 3 | - |
| Time Window (Self-guided) | - | - | - | - | - | 0 | - |
Output format (exactly four lines):
-
[right: True/False]
-
[jud: explanation]
Here is the VRP file:
{vrp_text}
Here is LLM's answer:
{problem_detail}
Output 1.2 Self-Validation
-
[right: True]
-
[jud: The specific problem name is consistent with the VRP file. All listed constraints are explicitly or implicitly supported by the instance content, and the required sections correspond exactly to those defined in the file. No contradictions are found, and the instance is correctly identified.]
Prompt 1.3 Revise
We need to solve a VRP instance. I will provide you with the instance. Please analyze it carefully.
Step 1. Identify the constraints of the instance and list them clearly in numbered format 1), 2), 3), ... within [ ]. For each constraint, write both the abbreviation (if any) and a short explanation (e.g., Capacity (C): vehicles have limited capacity). Do not include instance-specific details such as the exact number of nodes, vehicles, or capacity values.
Step 2. Write the standard problem type abbreviation (e.g., TSP, CVRP, CVRPL, VRPTW, OVRP, MDVRP), enclosed in quotation marks “”.
Step 3. List the sections that a correct and feasible instance should contain (e.g., DIMENSION, CAPACITY, if present).
Revision instruction. Below is your previous answer, followed by identified issues. Please revise your answer strictly according to the rules above and correct all inconsistencies.
Here is your previous answer:
{problem_detail}
However, there were some issues identified:
{judgment}
Output format:
-
[constraints]
-
"specific name"
-
[sections]
Output 1.3 Revise
- [
-
Capacity (C): each vehicle has a limited carrying capacity that cannot be exceeded.
-
Visit constraint (V): each customer must be visited exactly once.
-
Depot constraint (D): all routes must start and end at the depot.
]
-
"CVRP"
-
[DIMENSION, CAPACITY, NODE_COORD_SECTION, DEMAND_SECTION, DEPOT_SECTION]
D.2 Insight Generation
Prompt 2.1 Reasoning Path and Function Prompt Generation
You are an expert software engineer and operations research (OR) researcher. Your task is to design a validator program (program.py) in clean, production-ready Python that checks an instance for: (A) format validity and (B) feasibility under the given problem type and constraints, and produces a structured report.
Context
• Problem type: {specific_name}
• Constraints: {constraints}
• Required sections: {sections}
Below is the raw .vrp file content (do not alter it): {vrp_text}
Task
Think step by step and design a detailed plan for the validator program. Your design must explicitly specify:
• The checks to perform (format validity and feasibility under constraints).
• The functions to implement, with exactly one function per check.
For each function, provide:
• its purpose and role,
• the enforced constraints (if applicable),
• precise input and output definitions,
• its contribution to the overall validation workflow.
Include a main function that sequentially executes all validation functions.
Output format (STRICT)
Each output line must follow exactly this structure:
(1) [function_name: def function_name(inputs).description and purpose: what the function does.enforced_constraints: list of constraints checked (if applicable).
input: expected input format.]
(2) [function_name: def function_name(inputs).description and purpose: what the function does.enforced_constraints: list of constraints checked (if applicable).
input: expected input format.]
Output 2.1 Reasoning Path and Function Prompt Generation (Partly)
(1) function_name: def parse_vrplib_instance(vrp_text) description and purpose: Reads and parses the raw VRPLIB text, extracting metadata (NAME, TYPE, DIMENSION, CAPACITY, EDGE_WEIGHT_TYPE) and required sections (NODE_COORD_SECTION, DEMAND_SECTION, DEPOT_SECTION), and returns a structured dictionary for validation.
enforced_constraints: None (data extraction only).
input: vrp_text (string containing the raw VRPLIB instance).
(2) function_name: def
check_required_sections(parsed_instance)
description and purpose: Verifies that each required header
and section appears exactly once and reports missing or
duplicated entries.
enforced_constraints: VRPLIB format specification.
input: parsed_instance (dictionary returned by the parser).
(3) function_name: def
check_capacity_constraint(parsed_instance)
description and purpose: Checks whether any customer
demand exceeds the vehicle capacity and reports violating
nodes.
enforced_constraints: Capacity constraint (C).
input: parsed_instance (dictionary).
Prompt 2.2 Code Generation
We are working on a VRP problem instance to generate code that judges whether the instance is correct and feasible.
Context. If previously generated code is provided, it should be used as reference and may be improved or extended if necessary.
Problem Information.
Constraints: {constraints}.
Specific problem name: {specific_name}.
Sections that a correct and feasible instance should contain: {sections}.
Important Rules.
• The raw .vrp file content is provided only for context.
• Do not hardcode any instance-specific details such as node count, vehicle number, or coordinates.
• All generated functions must be general-purpose and reusable.
Task.
Generate validation functions as specified by the task description.
If the generated function is a main function, it must:
• Accept a command-line argument –path using the argparse library.
• Sequentially execute all validation functions.
• Print only the summary Total faults detected: [number].
If the generated function validates route feasibility, it must:
• Check feasibility from each customer to the depot (and back if required).
• Respect all declared constraints.
• Report each infeasible case as FAULT: [description].
Output Requirement.
Return only valid Python code enclosed in a single python code block.
Output 2.2 Code Generation (Partly)
import argparse import re import sys from collections import OrderedDict, defaultdict
REQUIRED_FIELDS = ["NAME", "TYPE", " DIMENSION", "CAPACITY", " EDGE_WEIGHT_TYPE"] REQUIRED_SECTIONS = ["NODE_COORD_SECTION", " DEMAND_SECTION", "DEPOT_SECTION"]
def check_required_sections(parsed_instance): faults = [] missing_fields = [] duplicated_fields = [] missing_sections = [] duplicated_sections = []
meta = parsed_instance.get('_meta', {}) header_counts = meta.get('_header_counts')
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
', {} )
section_counts = meta.get(' _section_counts', {})
for f in REQUIRED_FIELDS: c = header_counts.get(f, 0) if c == 0: msg = f"FAULT: Missing required field '{f}'" faults.append(msg) missing_fields.append(f) elif c > 1: msg = f"FAULT: Duplicated field '{f}': appears {c} times" faults.append(msg) duplicated_fields.append((f, c))
section_keys = set(parsed_instance.keys())
for s in REQUIRED_SECTIONS: c = section_counts.get(s, 0) section_exists_with_content = s in parsed_instance and bool( parsed_instance[s]) if c == 0 or not section_exists_with_content: msg = f"FAULT: Missing required section '{s}'" faults.append(msg) missing_sections.append(s) elif c > 1: msg = f"FAULT: Duplicated section '{s}': appears {c} times" faults.append(msg) duplicated_sections.append((s, c))
return { 'missing_fields': missing_fields, 'duplicated_fields': duplicated_fields, 'missing_sections': missing_sections 'duplicated_sections': duplicated_sections, 'faults': faults, 'count': len(faults) }
Listing 1: Example of route feasibility check
Prompt 2.3 Code Revision
We are working on a VRP problem instance to generate code that judges whether the instance is correct and feasible. Context. If previously generated code is provided, it is shown below and should be used as reference for correction.
Problem Information.
• Constraints: {constraints}
• Specific problem name: {specific_name}
• Sections that a correct and feasible instance should contain: {sections}
Important Rules.
• The raw .vrp file content is provided only for context.
• Do not hardcode any instance-specific details (e.g., number of nodes, vehicle count, node coordinates).
• All generated functions must be general-purpose and reusable for any VRP instance.
Instance Content (Context Only).
{vrp_text}
Detected Issues and Revision Guidance.
• Issues identified in the previous code: {error_msg}
• Revision suggestions: {jud}
Task. Please correct the previously generated code according to the issues above, without changing the number of functions, their names, or their function signatures.
Output Requirement. Return only valid Python code enclosed in a single python code block:
python
...
D.3 Report Generation
Prompt 3.1 Report Generation
You are an expert in VRP instance validation and repair. You are given the following information:
• A correct .vrp file used only as a format reference. Precise numeric values (e.g., distance limits) and optional sections are not treated as ground truth.
• A raw .vrp file that may contain faults.
• An initial list of detected faults, which may include duplicates or omissions.
Your task is to summarize all distinct faults and provide a complete repair.
Problem Context. This instance corresponds to {specific_name}. You must verify whether all values and structures are valid under the expected specification.
Summary Tasks. Provide the following four parts:
-
Detailed fault descriptions, including where the fault occurs (section, node ID, or line).
-
Suggested corrections, one per fault.
-
Corrected raw .vrp instance text with minimal necessary changes.
Critical Rules.
• Reason strictly from the raw .vrp content.
• Assume capacity and distance limit values themselves are not faulty.
• Do not remove or rewrite large portions unnecessarily.
• Keep section names, structure, and indexing intact unless invalid.
Input Information.
Format Reference Instance:
{right_text}
Initial Faults Detected:
{all_fault} Raw Instance with Faults: {vrp_text}
Output Format. Return only the following three parts, each enclosed in a separate code block:
• Detailed fault descriptions.
• Suggested corrections.
• Corrected raw .vrp instance text.
No extra commentary is allowed outside these blocks.
Output 3.1 Report Generation (Partly)
Detailed Fault Descriptions.
• Detailed fault descriptions. The node coordinate list is not explicitly preceded by the required NODE_COORD_SECTION header, leading to format ambiguity and non-compliance with the VRPLIB specification.
• The depot ID 1009 specified in DEPOT_SECTION is outside the valid node index range 1..51, does not appear in NODE_COORD_SECTION, and is missing from DEMAND_SECTION.
• The demands of nodes 27, 37, and 47 exceed the declared vehicle capacity, violating the capacity constraint of CVRP.
Suggested corrections.
• Insert the line NODE_COORD_SECTION immediately before the node coordinate list to ensure unambiguous parsing.
• Replace the invalid depot ID 1009 with a valid node index within 1..DIMENSION (e.g., node 1), and ensure that the depot appears in both NODE_COORD_SECTION and DEMAND_SECTION with zero demand.
• Modify the demands of nodes 27, 37, and 47 so that each individual demand does not exceed the vehicle capacity.
Corrected raw .vrp instance text.
NAME : corrected_instance TYPE : CVRP DIMENSION : 51 EDGE_WEIGHT_TYPE : EUC_2D CAPACITY : 100
NODE_COORD_SECTION 1 12.34 56.78 2 23.45 67.89 ... 51 98.76 54.32
DEMAND_SECTION 1 0 2 12 ... 27 40 37 35 47 30 ...
51 20 DEPOT_SECTION 1 -1 EOF