FLARE-NL¶
- milp_flare.flare_nl.flare_nl_prompt(formulation_a, formulation_b)[source]¶
Build the FLARE-NL prompt from two MILP formulations.
FLARE-NL is a natural language judge for
FLAREthat prompts an LLM to decided if one formulation is a reformulation of another according to the FormulationBench definition of reformulation. See Prompts for the full prompt. See the FLARE Paper for more details.- Parameters:
- formulation_a
str Markdown description of formulation A. Typically produced by
Formulation.render_markdown()from FormulationBench.- formulation_b
str Markdown description of formulation B. Typically produced by
Formulation.render_markdown()from FormulationBench.
- formulation_a
- Returns:
- prompt
FLARENLPrompt The system and user messages to send to the judge LLM.
- prompt
Examples
Use FLARE-NL to verify if formulation
bof problemp1from FormulationBench is a reformulation of formulationa:>>> from formulation_bench import Dataset >>> from milp_flare import flare_nl_prompt >>> ds = Dataset.load() >>> a = ds.problems[1].formulations["a"] >>> b = ds.problems[1].formulations["b"] >>> prompt = flare_nl_prompt(a.render_markdown(), b.render_markdown()) >>> print(prompt.user) You are given the following two Mixed-Integer Linear Programming (MILP)... ## Formulations ... ## Instructions - Do NOT make any assumptions about the formulation ... - When uncertain, state that formulation B is *not* a reformulation of A. - Provide a short summary of your conclusion ...
- class milp_flare.flare_nl.FLARENLPrompt(system, user)[source]¶
Return type of
flare_nl_prompt()with system and user messages.- Attributes:
- system
str System message describing the judge’s role. Set to
FLARE_NL_SYSTEM.- user
str User message containing the two formulations and instructions for the judge.
- system
- milp_flare.flare_nl.FLARE_NL_SYSTEM = 'You are an expert in mathematical optimization problems. You decide if one given MILP formulation is a reformulation of another.'¶
System prompt describing the FLARE-NL judge’s role.