Skip to main content
Back

VRPCoder Beats Gemini-2.5-Pro at Logistics Code With Just 8B Parameters

VRPCoder, an 8B model trained with constraint-aware reinforcement learning, beats Gemini and Claude on vehicle routing code generation by catching bugs that objective-only testing misses

Pro

Paper, Full Access
  • Core idea: LLMs generating optimization solver code can silently omit constraints that don't affect the objective on test cases -- a bug standard testing misses.
  • Solution: "Constraint injection" uses feasible probes and one-constraint-violating probes to catch both over- and under-constraining bugs in generated code.
  • VRPCoder: An 8B model trained with this dual verifier achieves 93% Pass@1 on vehicle routing benchmarks, beating Gemini-2.5-Pro Preview on 3 of 4 benchmarks.
  • Margin: VRPCoder-GRPO exceeds Claude Sonnet 4.5 by 28 points and prior OR-focused LLMs by 78 points on average.
  • Training: The verifier is used both as a rejection-sampling filter during data synthesis and as a reward signal in GRPO reinforcement learning fine-tuning.
  • Benchmark: The paper introduces an expert-verified VRP benchmark suite covering 21 variants targeting Gurobi solver code generation.

When you ask an LLM to write solver code for a logistics optimization problem, how do you know it actually got the constraints right? The objective value might look correct on your test cases, but the model could have silently dropped a critical rule -- say, the one preventing trucks from exceeding their load capacity -- and you'd never know until a real delivery route fails. A new paper from researchers at Xizi Luo, Changhong He, and colleagues tackles this blind spot head-on, and the results are striking: their 8-billion-parameter model, VRPCoder, outperforms Gemini-2.5-Pro Preview on three out of four benchmarks and beats Claude Sonnet 4.5 by 28 percentage points on average.

The Invisible Bug Problem

The field of Operations Research (OR) -- the discipline of turning real-world logistics and planning problems into mathematical optimization models -- has been an exciting target for LLM automation. A specialized and highly impactful application of LLMs has emerged in OR, specifically using them for automated optimization modeling: translating natural language descriptions of real-world problems into precise mathematical formulations or directly into executable solver code.

The standard way to check whether that generated code is correct is differential testing: run the model's code and a reference solution on the same inputs, and see if the objective values match. This works well for simple problems. But for constraint-dense combinatorial problems like Vehicle Routing Problems (VRPs) -- where dozens of operational rules interact -- it breaks down badly.

Here's why: many constraints are non-binding on typical test instances. A constraint that says "no vehicle can visit more than 10 customers" might never be violated on a small 5-customer test case, even if the generated code forgot to include it entirely. The objective scores match, the test passes, and the bug ships. Systematic failure modes include constraint misunderstanding and a feasibility-optimality decoupling where models achieve high feasibility but zero optimality.

Flowchart showing how LLM-generated code with omitted subtour elimination constraints passes objective-only verification but fails dual verification with constraint injection

Constraint Injection: A Smarter Test Suite

The paper's core contribution is a verification method called constraint injection. Instead of only checking whether the objective value matches, it probes the generated code with two types of adversarial test inputs:

  • Feasible probes: Inputs that are valid and should be accepted by any correct implementation. If the model's code rejects them, it has added spurious constraints -- rules that don't belong there (over-constraining).
  • One-constraint-violating probes: Inputs that deliberately break exactly one constraint. If the model's code accepts them, it has silently omitted that constraint (under-constraining).

Combined with traditional differential testing, this forms a dual verifier. The two probe types catch opposite failure modes: the feasible probe catches false rejections, and the violating probe catches false acceptances. Think of it like a security audit that tests both "can legitimate users get in?" and "can attackers sneak through?"

Diagram showing structural attacks (subtour cycle) and parameter attacks (move overload) used as constraint-violating probes

The probe construction itself is clever. For a VRP with a capacity constraint, a structural attack might inject a route that forms an illegal subtour (a loop that doesn't return to the depot). A parameter attack might construct a route where the total load on one vehicle slightly exceeds its limit. These are designed to be minimally violating -- they look almost correct, which is exactly what makes them hard to catch without explicit constraint checking.

From Verifier to Training Signal

The dual verifier isn't just used at evaluation time -- it's baked into the entire training pipeline in two ways:

  1. Rejection sampling during data synthesis: A teacher LLM generates candidate (problem, code) pairs. Only pairs that pass the dual verifier are kept for the training dataset. This filters out subtly broken examples before they can corrupt the model.
  2. Per-rollout reward in GRPO training: During reinforcement learning fine-tuning, each generated code solution is scored by the dual verifier. Solutions that pass both feasibility and constraint-violation checks get higher rewards.

GRPO (Group Relative Policy Optimization) is a reinforcement learning algorithm used to fine-tune LLMs based on outcome-based reward signals, designed to be simpler and more computationally efficient than earlier RL methods such as PPO, while achieving comparable or superior results on reasoning and instruction-following tasks. Unlike traditional PPO implementations that rely on a separate critic model to estimate value functions, GRPO employs group-relative advantages to perform policy updates directly, eliminating the need for additional value estimation components and thereby reducing computational overhead. In this work, the constraint injection verifier becomes the reward function -- the model learns to write code that passes adversarial constraint tests, not just code that gets the right answer on easy inputs.

Three-stage ML pipeline: supervised fine-tuning, frontier data selection via reward standard deviation, and GRPO training to produce VRPCoder-GRPO

The Benchmark: 21 VRP Variants

Vehicle Routing Problems are a natural testbed for this work. VRPs are fundamental to industrial and commercial applications such as logistics and transportation, yet they remain challenging to solve due to their diverse variants with intricate real-world constraints. The paper introduces an expert-verified benchmark suite covering 21 VRP variants, including combinations of:

  • Capacitated VRP (CVRP) -- vehicles have load limits
  • VRP with Time Windows (VRPTW) -- customers must be served in specific time slots
  • VRP with Pickup and Delivery (VRPPD) -- items must be picked up before being dropped off
  • Multi-depot, heterogeneous fleet, and open route variants

Each variant stacks multiple interacting constraints, making it an ideal stress test for constraint completeness. The target output is executable Gurobi solver code -- a professional-grade mixed-integer programming solver used in industry. The evaluation metric is Pass@1: does the first attempt produce correct, executable, constraint-complete code?

Results That Turn Heads

VRPCoder-GRPO, the 8B model trained with this pipeline, achieves 93% average Pass@1 across four VRP benchmarks. To put that in context:

  • It outperforms Gemini-2.5-Pro Preview on three of four benchmarks
  • It exceeds Claude Sonnet 4.5 by 28 average percentage points
  • It surpasses prior OR-focused LLMs by 78 average percentage points

The 78-point gap over prior OR-LLMs is particularly telling. Learning-based approaches involve fine-tuning LLMs on domain-specific datasets to achieve deeper understanding and generation capabilities, with key prior contributions including ORLM and LLMOPT. Those models were trained without constraint-aware verification -- and the gap shows exactly how much signal was being left on the table by relying on objective equivalence alone.

What This Means in Practice

The immediate use case is logistics and supply chain automation. Any company that needs to translate operational rules ("trucks can't exceed 10 tons," "deliveries must arrive before 5pm," "perishables must be picked up before drop-off") into solver code currently needs an OR expert to write and validate that code. VRPCoder points toward a future where that translation is automated and verifiable.

But the deeper contribution is the verification methodology itself. Constraint injection as a dual verifier is a general technique applicable beyond VRPs -- anywhere that LLM-generated code must satisfy a set of logical rules that won't all be exercised by standard test cases. Bugs may arise for several reasons: some stem from syntactic errors, others from logical flaws, and still others from unmet requirements, such as failing to incorporate certain constraints. The dual verifier catches the third category, which objective-only testing misses entirely.

The model is described as an end-to-end 8B system, though the paper does not currently include a public model release or code repository. The benchmark suite is expert-verified and covers 21 VRP variants, making it a potentially valuable evaluation resource for the OR-LLM community as the field matures.