Anvil: the deterministic compiler.
The agent formulates a decision once. Anvil compiles it to solver-ready code with zero model calls, so the same input always lands the same code. On NLP4LP, that scores 90.1%.
NLP4LP · 332 evaluable problems · CBC, a free open-source solver Full methodology ↓
How Anvil works
The usual approach hands an LLM the whole path from problem to solver-ready code, 10–20 model calls, each one a chance to drift or hallucinate, and no two runs guaranteed alike. Anvil uses the model exactly once: to turn the natural-language problem into a structured LaTeX formulation, with its sets, parameters, variables, objective, and constraints. A constraint database guides that step, supplying the right constraints for each problem type along with their code, their common pitfalls, and when they apply. After that single call, the compiler takes over and no model touches the work again.
Four stages, no model in the loop:
- Normalizer canonicalizes the LaTeX so the parser always sees consistent input.
- Parser extracts the math into an intermediate representation: sets, parameters, decision variables, the objective, and constraints.
- Analyzer is the heavy stage. 12 validation and enrichment passes check that the IR is faithful to the formulation, checking linearity and constraint signs and resolving every data reference against the actual datasets.
- Emitter generates deterministic Python from the validated IR.
Anvil handles LP, MILP, SOS1/SOS2, Big-M formulations, multi-indexed variables, and dense summation patterns. When compilation fails, it does not bail to LLM code generation. It runs a per-constraint repair loop, keeping a history of errors so it stops repeating mistakes. Only after three failed attempts does it fall back to the model, and only for the section that broke, with the error in hand. The common case is fully deterministic. Even the failure path is structured and auditable.
What Anvil guarantees
Guarantees that follow from determinism, not from any amount of prompt engineering:
Reproducibility
The same LaTeX always compiles to byte-identical Python. Same inputs, same model, same output, every time. That is table stakes for regulated work, and for anywhere the output drives money.
Auditability
The intermediate representation is inspectable at every stage. When a constraint looks wrong, you follow it back: the parser rule that matched, the analyzer pass that resolved each symbol, the template that emitted the code. LLM generation hands you a black box of token probabilities.
Cost & latency
Zero compile-time model calls means zero compile tokens and sub-second builds, 0.00–0.02s per problem. An LLM translation call runs 5–15s and costs $0.01–0.10, and that is today’s price.
Testability
Six gates run in CI: compilation, syntax, execution, structural match, solution match, and byte-identical snapshot. Each one is deterministic. You cannot write a real snapshot test against stochastic code.
90.1% on the NLP4LP benchmark
NLP4LP is a set of 361 linear and mixed-integer problems pulled from textbooks and academic sources, and it is the current yardstick for agentic optimization. Each problem gives a plain-language description and its data as unstructured text. Of the 361, 332 carry a numeric ground-truth objective we can score automatically. The other 29 do not: the answer is infeasible, or there is no single objective to check, so they sit out. Every number here is measured on those 332.
Against the state of the art
OptiMUS-0.3 is the strongest open system for LLM-driven optimization. On the same 332 problems, here is where the two land.
| System | LLM backbone | Solver | Evaluable | Accuracy | Formulate | Compile |
|---|---|---|---|---|---|---|
| LogiModel AI | LLM formulate + deterministic compile | CBC | 332 | 90.1% | 1 | 0 |
| OptiMUS-0.3 (o1) | o1 (every step) | Gurobi | 332 | 80.6% | 3–5 | 7–15 |
| OptiMUS-0.3 (GPT-4o) | GPT-4o (every step) | Gurobi | 332 | 73.7% | 3–5 | 7–15 |
Anvil wins on a free solver, and it gets there with one model call and none to generate code, against OptiMUS-0.3’s 3–5 to formulate and 7–15 to compile. Fewer calls, fewer places for an error to compound.
Compilation, by difficulty
The June 2026 run breaks compilation down by how hard the problem is. These are compile rates, not the accuracy above:
The hard set is where the work is. Multi-stage problems like column generation and stochastic programming need structural transforms that an LLM alone gets wrong, and that is where we are spending our time. OptiMUS does not report this split, so we leave it out of the comparison.
What this means if you run the network
Everything above is a technical result. Here is what it changes for the person who signs off on the plan.
What does 90.1% actually mean for the decisions I run?
The answer matched. Each of the 332 problems has a known correct value, and Anvil scores only when its number hits it. Clean code that returns the wrong figure earns nothing. It is the same job your planners do by hand under driver staffing, SKU replenishment, and fulfillment placement: read the decision, take the data as it comes, produce the right number. 90.1% is how often it lands without anyone checking the math.
These are textbook problems. My network is messier than that.
It is, and the benchmark doesn’t pretend otherwise. Your carrier caps, your MOQs, and the fairness rules living in your SOPs are not in NLP4LP. What it does test is the step that breaks most projects: turning a decision described in English into a model that is mathematically correct. That part carries over. Bring one real decision to a 30-minute working session and we model it live, then show you the formulation Anvil produced, line by line.
How do I know when it gets one wrong?
Because it tells you. Anvil checks linearity, constraint signs, and every data reference against your actual dataset. When something doesn’t hold, it stops and hands back a typed error instead of a number. That matters more than the 90.1%. A model that misses 1 in 10 and says so is safe to plan with. One that misses 1 in 10 and stays quiet is the one that costs you a quarter.
My CFO asks why this week’s plan changed. What do I tell them?
That the data moved, and here is the proof. Anvil produces the same model from the same inputs, byte for byte, and every run carries the decision trail that built it, a RUN number, and a rerun button. So a plan changes only when your network changes, and you can point to exactly what. Ask an LLM to rewrite the model each week and you lose that. A number that moves when nothing else did is one you cannot defend.
Do I need an OR team to run this?
No. Describe the decision in plain English, the agent writes the formulation, and Anvil turns it into solver-ready code. The answer comes back in dollars. If you do have analysts, they get a formulation they can read, argue with, and correct at each stage. A system that writes code straight from a prompt gives them nothing to push against.
Do I have to license Gurobi to get this accuracy?
No. The accuracy comes from Anvil, not from an expensive solver. The 90.1% runs on free CBC, while OptiMUS posts its 80.6% on licensed Gurobi. At scale the agent picks the right solver per problem across HiGHS, CBC, Gurobi, and SCIP, so a license buys you speed on the big models. It doesn’t buy you a right answer.
Your decision isn’t in here? Bring it to a call. Thirty minutes, one real problem, no pitch.
Deterministic, reproducible, auditable. Every time.
Bring a real optimization problem. We formulate it, compile it, and show you the model it produced, line by line.