Papers
Topics
Authors
Recent
Search
2000 character limit reached

Beyond Objective Equivalence: Constraint Injection for LLM-Based Optimization Modeling on Vehicle Routing Problems

Published 3 Jun 2026 in cs.AI and cs.LG | (2606.04816v1)

Abstract: LLMs increasingly translate natural-language optimization problems into executable solver code. Yet for constraint-dense operations research (OR) problems, existing data-filtering and training pipelines largely rely on objective-equivalence signals such as differential testing and answer agreement, which a program can pass while adding spurious constraints or silently omitting required ones, whenever those constraints are non-binding on the tested instance. We propose constraint injection, which uses feasible probes to expose spurious over-constraint and one-constraint-violating probes to reveal silent constraint omission. Combined with differential testing, it forms a dual verifier. We instantiate and evaluate it on vehicle routing problems (VRPs), a representative constraint-dense combinatorial optimization testbed with coupled operational constraints. We develop VRPCoder, an 8B end-to-end model that translates natural-language VRP scenarios into Gurobi scripts, together with an expert-verified VRP benchmark suite covering 21 variants. The verifier is reused as a rejection-sampling filter during data synthesis and as a per-rollout reward in group relative policy optimization (GRPO). Across four VRP benchmarks, VRPCoder-GRPO reaches 93\% average Pass@1, outperforms Gemini-3.1-Pro Preview on three benchmarks, exceeds Claude-Sonnet-4.5 by 28 average points, and surpasses prior OR-LLMs by 78 average points.

Summary

  • The paper introduces constraint injection, a dual verifier that uses feasible and one-constraint-violating probes to detect spurious constraints and silently omitted requirements beyond objective matching.
  • The paper’s VRPCoder-GRPO model reaches 93.00% average Pass@1 across 700 vehicle-routing problems, improving on SFT by 4 points and outperforming prior OR-LLMs by more than 78 points.
  • The paper shows that constraint-level supervision improves generalization, with injection raising GRPO performance from 80.40% to 88.00% on cross-source problems and exposing limitations for soft constraints and non-routing domains.

The blind spot of objective equivalence

LLM-based optimization modeling pipelines—whether supervised fine-tuning (SFT) on synthetic problem–code pairs or reinforcement learning (RL) with solver feedback—predominantly accept programs based on objective equivalence: executability, differential testing against a reference script, or agreement of optimal objective values. This paper argues that such signals are structurally incapable of verifying the constraint set itself. A candidate program can add a spurious constraint or silently omit a required one and still match the reference optimum, provided the affected constraint is non-binding on the tested instance. The authors name these two failure modes spurious over-constraint and silent constraint omission, and show that both pass existing filters and receive positive RL rewards. A canonical example is a routing model missing subtour-elimination constraints: if the tested instance's optimum happens to be unaffected, differential testing accepts the buggy program.

Constraint injection as a dual verifier

The proposed remedy is constraint injection, an operator that converts a candidate Gurobi model into a pure feasibility query by replacing its objective with a constant and appending constraints that encode a given routing solution. Two complementary probe types target the two failure modes:

  • Feasible probes s+s^+: solutions feasible under all intended constraints. A correct program must accept them; rejection indicates spurious over-constraint.
  • One-constraint-violating probes {si}\{s_i^-\}: for each targeted constraint family cic_i, a solution violating only cic_i. A correct program must reject them; acceptance indicates silent omission.

Each verdict is decoupled from the optimum on any single instance, which is precisely what differential testing cannot provide. Combined, the two operators form a dual verifier.

Probe construction is systematic. Feasible probes come from variant-specific heuristics (nearest-neighbor insertion) with time-limited gold-solver fallbacks. Violating probes are derived from s+s^+ via two categories of attack operators: structural attacks modify only the visiting sequence (e.g., subtour cycle targeting MTZ elimination, remove-customer targeting coverage, precedence violation for pickup-delivery), while parameter attacks additionally tighten one resource bound so it falls strictly between the usage of s+s^+ and the perturbed probe (e.g., capacity overload, distance overrun, compartment overload). Injection encoding adapts to fleet structure: 2D edge projection for homogeneous-fleet feasible probes, vehicle binding added for violating probes (to prevent the solver from splitting an overloaded route across vehicles), and full 3D arc–vehicle fixing for heterogeneous fleets. Depot-edge structure is deliberately left to differential testing.

Data synthesis and training pipeline

Each training sample is a six-tuple containing the instance, natural-language statement, gold script, regenerated script, feasible probe, and violating-probe set. A four-stage pipeline assembles these: expert-written gold scripts over a CVRP backbone with modular constraint extensions; teacher-LLM rewriting into problem statements through three paths (scenario instantiation with generate–critique–repair, condensation removing solver-side wording, index rewriting with recorded node-ID maps); code regeneration by the same teachers; and dual-verified rejection sampling, where samples passing differential testing but failing injection are discarded from SFT data but reserved for ablation analysis.

The verifier is reused identically across stages: as the rejection filter during synthesis and as part of the GRPO reward r=0.2rbuild+0.5rdiff+0.3rinjr = 0.2\,r_{\text{build}} + 0.5\,r_{\text{diff}} + 0.3\,r_{\text{inj}}, where rinjr_{\text{inj}} is the fraction of probes correctly classified. GRPO uses frontier-sample filtering—retaining only prompts whose offline rollouts have strictly positive within-group reward variance—to reduce online sampling cost. Training applies LoRA (r=16r=16) to Qwen3-8B: SFT on 6,797 pairs, then GRPO on 716 frontier prompts with G=8G=8 rollouts, on four A100-40GB GPUs.

Benchmark suite

The evaluation covers 700 expert-verified problems across four benchmarks spanning in-distribution synthesis (310 problems), held-out compositional variants combining familiar modules in unseen pairings (66), classical public-library instances downsampled to 5–12 customers (74), and cross-source routing problems from NLCO, MAMO, IndustryOR, and OptMATH (250). The training corpus spans 18 VRP variants built from ten constraint modules (multi-depot, multi-compartment, pickup-delivery, open routes, hard/soft time windows, distance limits, backhauls, split delivery, heterogeneous fleets); three pairwise combinations are strictly held out.

Main results

VRPCoder-GRPO achieves 93.00 average Pass@1, computed over all 700 problems at an absolute objective tolerance of {si}\{s_i^-\}0.

Model Bench 1 Bench 2 Bench 3 Bench 4 AVG
Gemini-3.1-Pro Preview 95.81 89.39 91.89 96.40 95.00
Claude-Sonnet-4.5 70.65 42.42 79.73 58.80 64.71
DeepSeek-V3.2 31.29 7.58 51.35 45.60 36.29
Qwen3-8B (base) 0.00 0.00 1.35 1.20 0.57
SIRL-Gurobi-32B (best prior OR-LLM) 8.71 3.03 1.35 30.00 15.00
VRPCoder-SFT 92.26 89.39 82.43 85.20 88.43
VRPCoder-GRPO 96.13 96.97 93.24 88.00 93.00

The 8B model outperforms Gemini-3.1-Pro Preview on three of four benchmarks, exceeding it by 7.58 points on the compositional Benchmark 2; it trails only on Benchmark 4, which the authors attribute to 50 TSPTW instances absent from training. It exceeds Claude-Sonnet-4.5 by 28 average points and every prior OR-LLM by more than 78 points—the strongest prior OR-LLM reaches only 15.00 average Pass@1. The specialization effect is stark: the same base model rises from 0.57 to 93.00, a 92-point absolute gain.

Ablation evidence for constraint-level supervision

Removing injection from both stages—admitting differential-only samples into SFT and dropping {si}\{s_i^-\}1 from the GRPO reward—lowers average Pass@1 from 88.43 to 85.57 (SFT) and from 93.00 to 89.00 (GRPO). Notably, this comparison is conservative: the no-injection baseline trains on a larger SFT set (7,347 vs. 6,797) and a larger frontier-prompt pool (855 vs. 716). The largest gains appear under distribution shift: GRPO improves from 80.40 to 88.00 on the cross-source Benchmark 4, and SFT improves from 81.82 to 89.39 on the unseen-combination Benchmark 2. These results support the paper's central claim that constraint-level verification carries information beyond objective matching, particularly when models must generalize to unseen constraint combinations.

Limitations and open questions

The authors are explicit about scope. Empirical validation is confined to vehicle routing; transfer to scheduling, facility location, or production planning is untested. The dual verifier depends on structured gold formulations and manually designed attack heuristics—exotic domain-specific rules still require human attacker design, though the attack catalog is offered as a taxonomy for future semi-automated oracle construction. Evaluation remains instance-level Pass@1, which compresses the verifier's richer constraint-level feedback into a binary signal; developing metrics that report per-constraint violation profiles is left open. Additionally, probes are not constructed for penalty-based mechanisms such as soft time windows, which remain covered only by objective-equivalence signals, and depot-structure errors rely primarily on differential testing rather than injection.

Conclusion

This paper identifies objective equivalence as a shared, structural blind spot in both SFT filtering and RL rewards for LLM-based optimization modeling, and introduces constraint injection—a feasibility-query operator using feasible and one-constraint-violating probes—as a complement to differential testing. Reused consistently as a data filter and a GRPO reward, it yields VRPCoder, an 8B model reaching 93% average Pass@1 on VRP modeling, competitive with frontier closed-source LLMs and far above prior OR-LLMs, with ablations attributing the gains specifically to constraint-level supervision. The main open questions are generalization beyond routing, automation of attacker construction, and evaluation metrics that preserve constraint-level granularity.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.