TL;DR
RFTHGS demonstrates that a relatively small, 14B-parameter LLM can be fine-tuned via reinforcement learning to design C++ crossover operators that outperform human-expert heuristics in state-of-the-art solvers. By using a multi-tiered curriculum reward and anti-plagiarism mechanisms, the framework produces specialized code that generalizes to large-scale vehicle routing problems (up to 1000 nodes), surpassing even massive models like GPT-4o.
What Problem Does This Paper Address?
The Capacitated Vehicle Routing Problem (CVRP) is a cornerstone of logistics and supply chain management, but because it is NP-hard, finding optimal solutions for large-scale instances is computationally grueling. For decades, the gold standard has been the Hybrid Genetic Search (HGS) solver, which relies on sophisticated, human-engineered "crossover operators" to combine parent solutions into better offspring.
While Large Language Models (LLMs) have shown promise in automating algorithm design, they face three major hurdles:
- Hallucinations: They often generate code that doesn't compile or crashes.
- Performance Gaps: Prompt-based methods using general-purpose models (like GPT-4) often fail to beat highly optimized expert baselines.
- Scalability: Heuristics designed for small problems often fail to generalize to industry-scale instances.
The authors set out to prove that a small, open-source model, if properly fine-tuned, can move beyond being a "coding assistant" to becoming a "super-expert" designer.
Methods
The authors introduce RFTHGS, a reinforcement learning (RL) framework designed to fine-tune a Qwen-14B model. The core of their approach lies in how they guide the model's learning process:
- Multi-Tiered Curriculum Reward: Instead of just rewarding the final solution quality, the framework uses a tiered system to guide the LLM through stages of competence:
- Compilability: Is the code syntactically correct?
- Executability: Does it run without timing out or crashing?
- Performance: Does it actually improve the solver's results compared to the human-designed baseline?
- DAPO Algorithm: They use Decoupled Advantage Policy Optimization (DAPO), an evolution of the GRPO algorithm used in models like DeepSeek-R1, which allows the model to more aggressively learn from high-performing code samples.
- Anti-Plagiarism Cache: To prevent the LLM from simply "copy-pasting" the examples provided in its prompt, the system uses Abstract Syntax Trees (AST) to compare the logical structure of new code against known examples, penalizing direct copies to encourage true innovation.
- Incremental Compilation: To make RL training feasible, they implemented a system that only recompiles the modified operator rather than the entire HGS library, cutting evaluation time by 75%.
Datasets
The framework was trained and evaluated using the CVRPLIB X instances, a standard benchmark in the field.
- Training: A fixed set of 30 instances with up to 400 nodes.
- Evaluation: The full CVRPLIB suite, including large-scale problems with up to 1,000 nodes to test generalization.
Key Insights and Ideas
- Small Models, Big Results: A fine-tuned 14B model significantly outperformed trillion-parameter giants like GPT-4o. This suggests that for specialized tasks like algorithmic optimization, domain-specific fine-tuning is more powerful than raw model scale.
- The "Exceeds Expert" Inflexion Point: Training dynamics show a clear transition around step 200 where the model stops just trying to "write code that works" and starts discovering heuristics that are fundamentally better than what humans designed.
- Generalization is Possible: Even though the model was only trained on problems with fewer than 400 nodes, the operators it designed remained superior on problems with 1,000 nodes. This indicates the LLM learned robust algorithmic principles rather than just over-fitting to small instances.
Key Results
- Compilation Success: RFTHGS achieved a 100% (16/16) successful compilation rate in testing, compared to only 18.75% (3/16) for GPT-4o and GPT-4o-mini.
- Solution Quality: On the largest instances (800-1000 nodes), RFTHGS achieved a gap of 2.17%, outperforming the expert-designed HGS baseline (2.22%) and crushing neuro-combinatorial methods like POMO, which had gaps exceeding 40%.
- Zero-Shot Superiority: The fine-tuned model's operators were consistently better than those generated by prompting GPT-o3 and GPT-4o, which often failed to produce any functional improvement over the default HGS code.
Limitations and Future Work
While impressive, the authors note a few areas for growth:
- Scope: The study focused exclusively on the crossover operator. Future work could involve fine-tuning LLMs to optimize other HGS components, such as local search procedures or population management strategies.
- Problem Diversity: The current work is limited to CVRP. The authors plan to extend this framework to other VRP variants, such as those with time windows or heterogeneous fleets.
- Safety: There is a lingering risk that LLM-generated code could contain subtle bugs that only appear in edge cases, necessitating rigorous validation before deployment in real-world logistics systems.
Summary updated