Can LLMs Design Operations Research Algorithms?
1. An Uncomfortable Question
Consider a warehouse manager deciding weekly stock levels: too little causes stockouts, too much causes holding costs, demand is random, and supply is delayed. Operations research has spent sixty years on such inventory control problems—from 1960s base-stock policies to capped base-stock, and in 2022, A3C deep reinforcement learning. That A3C pipeline cost 24 CPU hours per hyperparameter combination × 250 combinations = 6000 CPU hours, and produced an opaque neural network policy you cannot interpret.
Now someone asks: can an LLM do this directly?
Not solving a single instance—writing an *algorithm*. Give the LLM a problem description and parameter ranges, and it returns Python code that works across all instances. Jackie Baek (NYU Stern) posted a paper to arXiv (2608.27296) showing the answer is yes—and it outperforms the best human-designed methods.
2. Two Levels of Testing
- Level 1: Given a concrete instance (e.g., demand mean 20, lead time 8, penalty 5), return the solution for that instance. Like solving one exam problem.
- Level 2: Given only a problem class description and parameter ranges, return an algorithm—code that takes arbitrary parameters and outputs solutions. Like writing a program that solves the exam.
- Inventory control: a "projected inventory policy" preserving capped base-stock structure, but replacing raw inventory position with a risk-adjusted projected inventory statistic approximating the on-hand distribution over the lead-time window—exact Poisson moments for the first step, normal approximation thereafter, parameters via coarse-then-refined simulation search. It recombined known concepts (capped base-stock, projected inventory position) with a novel twist humans hadn't implemented.
- Queueing networks: dynamic programming on small state spaces; pressure-based scheduling rules on larger networks—a classic queueing idea the LLM chose itself.
- Assortment optimization: standard OR primitives composed—relaxation, rounding, repair, local improvement, occasional exact solving of small subproblems.
- gpt-5.1 (2025-11-13): weak at Level 1, worse at Level 2
- gpt-5.4 (2026-03-05): Level 1 near-baseline, Level 2 never surpassed
- claude-fable-5 (Anthropic): strong Level 1, reliable but below gpt-5.6-sol at Level 2
- gpt-5.6-sol: surpassed baselines at both levels
- For OR researchers: generated algorithms are variants and combinations of existing ideas, but frontier LLMs can recombine a field's accumulated algorithmic knowledge into working solvers at near-zero cost. Research value may shift toward defining problems, validating algorithms, and judging objectives.
- For AI engineers: the Level 1 vs. Level 2 distinction is a valuable capability-probing methodology—tasks that fail at Level 1 may succeed at Level 2 (writing a program for the whole task class).
- For everyone: A3C took 6000 CPU hours to produce a black box; the LLM took 1 hour to produce better, readable code. Before reaching for deep RL, ask: could an LLM just write the algorithm?
- Pessimistic: LLMs only recombine existing knowledge; no true originality.
- Optimistic: recombination itself is creation. The projected inventory statistic wasn't in the literature; the specific implementation was novel. If the combination were obvious, humans would have done it already.
Human input was minimal: one untuned prompt, a Python sandbox, and a 3600-second compute budget. No few-shot examples, no chain-of-thought scaffolding, no per-problem prompt engineering.
3. Three Battlegrounds
1. Lost-sales inventory control — the OR "Hello World" with many human-designed baselines. 2. Queueing network control — multi-server, multi-class, finite-buffer scheduling (cloud servers, ER triage). 3. Assortment optimization — selecting products to maximize revenue under constraints (e-commerce, retail).
4. Results
Using gpt-5.6-sol, across all ten problem classes:
| Metric | Result | |--------|--------| | Level 1 | Beat best tuned benchmarks on 23 of 26 lost-sales instances; the other 3 within 0.5% | | Level 2 | One algorithm across all 26 instances: beat best benchmark on 21; all within 0.5% | | MMNL assortment | Level 2 algorithm achieved exact optimality on all 628 instances | | Constrained MMNL | Matched the best method on all 1794 instances | | Queueing networks | Matched or beat best heuristics on multiple network classes |
One LLM, one prompt, one call, one-hour sandbox—matching or exceeding sixty years of the best specialized human algorithms.
5. A3C vs. LLM Level 2: Black Box vs. Readable Code
A3C (Gijsbrechts et al., Management Science, 2022) was the SOTA for lost-sales problems:
| Dimension | A3C | LLM Level 2 | |-----------|-----|-------------| | Compute | 6000 CPU hours | 1 hour sandbox | | Output | Black-box neural policy | Inspectable, explainable Python code | | Generality | Per-instance, no cross-instance transfer | One algorithm for the whole problem class | | Lost-sales performance | Mostly matched strong heuristics | Beat best benchmarks at all lead times |
A3C is a Level 1 method; the LLM's Level 2 output does more, at lower cost, and the artifact is code you can read, modify, and debug.
6. What Do LLM-Designed Algorithms Look Like?
The LLM did not conjure magic—it produced algorithms with identifiable structure:
The paper states: "the generated algorithms are not mysterious black boxes. They are often variants and combinations of familiar OR ideas."
7. Capability Gradient Within Eight Months
Eight months from "can't do it" to "beating the best human methods." The paper concludes: frontier LLMs are becoming a natural empirical baseline for hard OR problems.
8. Two Key Objections, Answered
Data contamination? A holdout test ran the *frozen* Level 2 code on newly constructed instances (different demand means, penalties, lead-time ranges). gpt-5.6-sol's code continued to beat the best benchmark on all holdout instances—memorized answers wouldn't transfer.
Web search leakage? A controlled experiment gave the model unrestricted web search. It performed only brief literature checks or none; the final algorithms and results were completely unchanged. Retrieval was not the bottleneck.
9. How the LLM "Thinks" About Algorithm Design
The paper's Appendix G documents a stable six-step reasoning pattern in Level 2 runs:
1. Formalize the problem, recall known structures (e.g., revenue-order theorems for MNL vs. nested logit) 2. Enumerate candidate method families, weighing accuracy vs. compute cost 3. Budget computational resources within the 3600-second sandbox 4. Build a testbed and validate against ground-truth baselines on small instances 5. Identify failure modes, add guardrails (e.g., don't order when effective penalties are non-positive) 6. Format output to spec
This is the standard workflow of a human OR researcher. The LLM isn't reciting answers—it's following the process.
10. What This Means for Practitioners
11. Knowledge Recombination vs. Knowledge Creation
The paper's most quotable line—"the generated algorithms are often variants and combinations of familiar OR ideas"—admits two readings:
12. Closing: An Uncomfortable Analogy
When Deep Blue beat Kasparov in 1997, chess said "just brute-force search." Twenty years later, AlphaZero earned "that's real intelligence." A3C's black box was a milestone; will LLM-written code that performs better be dismissed?
If history repeats: denial, acceptance, redefinition. But this time there's a difference—the output isn't a black box, it's code you can read, modify, and understand. When AI's artifact becomes an inspectable engineering product, the "just search" consolation stops working.
Paper: https://arxiv.org/abs/2608.27296 Code and full logs: https://anonymous.4open.science/r/llm-or-algorithms-F9F2