Skip to main content

milp-flare

PyPI version CI codecov Documentation Status License: MIT Checked with mypy Ruff

[!NOTE] This is the official implementation of FLARE and FLARE-NL introduced in FLARE: Verifying MILP Reformulations with LLM-Based Theorem Proving.

FLARE (Formulation-Level Automated Reformulation Evaluation) uses an LLM-based agent and the Lean proof assistant to verify mixed-integer linear program (MILP) reformulations according to the FormulationBench definition of reformulation. FLARE-NL is a Large Language Model (LLM) proxy for FLARE that trades off formal guarantees for speed and cost. See the documentation for details.

Installation

pip install milp-flare

FLARE runs an agent harness (e.g., Claude Code, Codex, OpenCode) in a Docker container. The Docker image must be built prior to running the method.

milp-flare build-image

Furthermore, each agent harness has different requirements for authentication. See Installation for more details.

Quickstart

FLARE is most frequently run on the FormulationBench dataset (though it is not a strict dependency).

from pathlib import Path

from formulation_bench import Dataset
from milp_flare import FLARE, FormulationInput, ParameterMapInput
from milp_flare.harness import ClaudeCodeHarness

ds = Dataset.load()
pair = ds.reformulations[0]  # p1.a -> p1.b
a, b = pair.a, pair.b

harness = ClaudeCodeHarness(model="claude-opus-5", effort="medium")
flare = FLARE(harness=harness)

a_in = FormulationInput(
    formulation_md=a.render_markdown(), solve_py=a.gen_solve_py()
)
b_in = FormulationInput(
    formulation_md=b.render_markdown(), solve_py=b.gen_solve_py()
)
map_in = ParameterMapInput(
    map_md=pair.parameter_map.render_markdown(), map_py=pair.gen_map_py()
)

result = flare.verify(a_in, b_in, map_in, output_path=Path("runs/p1_a_b"))

Development

See AGENTS.md for development information.

Cite

@unpublished{robbins2026flare,
  title = {FLARE: Verifying MILP Reformulations with LLM-Based Theorem Proving},
  author = {Robbins, Henry and Lawless, Connor and Udell, Madeleine and Vitercik, Ellen},
  year = 2026,
  note = {Working paper},
  url = {https://flare.henryrobbins.com}
}

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

milp_flare-0.3.0.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

milp_flare-0.3.0-py3-none-any.whl (60.1 kB view details)

Uploaded Python 3

File details

Details for the file milp_flare-0.3.0.tar.gz.

File metadata

  • Download URL: milp_flare-0.3.0.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for milp_flare-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cdef0e7dd238b9dc9c1ba864e5a826397f59aea99bff73c7dcdf56a885d0396e
MD5 d4335e838b5a48d2a89bfeb1f989beda
BLAKE2b-256 0b117b72398c0ecdc540209a5260f97083b369d679b23aa2fbeaafe717c5cb1e

See more details on using hashes here.

File details

Details for the file milp_flare-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: milp_flare-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 60.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for milp_flare-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54073580589681e5c17ab8d8b616cec333d4e6db854ff1766485413ede7e6334
MD5 0b490767ea878b9cbafa05f5e66206b9
BLAKE2b-256 a4a27dc0e0d4699dc7e4efbb53158cae3457f9958feba77ff46df5d6afc32eb7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page