Where Bias Enters When LLMs Write the Optimization Model

Organizations are starting to ask language models to turn a messy description of an allocation problem, such as who gets a treatment slot, which applicants advance, or how shifts are assigned, into a formal optimization model. A conventional solver then computes the "optimal" answer. This looks safer than letting the model rank people directly, because the solver is deterministic and blind to identity. That safety is borrowed, though. The model still decides which real-world factors to keep and which to simplify away, how heavily to weight each criterion, and what numerical value to read out of each person's free-text record. Each of those choices is a simplification, and each is a place where inherited stereotypes can enter and then be certified as optimal by the solver.

We propose to treat the LLM-written formulation as the object of a fairness audit. A formulation is a discrete, structured artifact made of variables, weights, constraints, and extracted feature values. That makes it possible to run something that free-text reasoning chains do not allow. We regenerate the formulation under demographic counterfactuals of the same scenario, compute an exact diff between the resulting formal models, and attribute the final allocation disparity to three specific channels: the rule the model wrote, the per-person values it extracted, and the operational factors it dropped. The same diff yields a repair. Any element of the formulation that changes when only identity cues change is replaced with its counterfactually invariant version before solving.

Core Claim

We claim that in LLM-plus-solver allocation pipelines, most of the measured allocation disparity can be traced to a small number of formulation elements that vary with demographic cues. This disparity is not evenly spread across the reasoning. A large share of it comes from the omission channel, where the model simplifies away friction factors whose cost falls unevenly on groups. One example is availability constraints that matter mostly to caregivers. We further claim that enforcing counterfactual invariance at the level of the formulation reduces top-$k$ allocation disparity at a smaller cost in task utility than enforcing it on the outputs of direct ranking. The new element is a three-way decomposition of allocational harm into rule, extraction, and omission channels. That decomposition is only measurable because the intermediate representation is formal rather than textual.

Why This Gap Is Real

The evidence that reasoning carries bias comes from free-text settings. Does Reasoning Introduce Bias? shows that chain-of-thought reasoning amplifies bias on ambiguous BBQ questions. Its inference-time fix, ADBP, watches how the predicted answer shifts as reasoning steps are fed back, and it relies on a GPT-4o judge to score bias step by step. SocialStigmaQA finds the same paradox: intermediate steps rationalize stigma even when the final answer looks neutral, and single-word rephrasings swing bias by over ten points. Uncovering Stereotypes … Task Complexity shows that refusal guardrails weaken as tasks grow more complex. All three papers motivate our work. They establish that harm lives in the intermediate reasoning. They also constrain it, because they locate that harm only through judges or manual reading, which cannot say which intermediate decision caused a given allocation gap. Our formal intermediate removes the need for a judge in localization.

On the measurement side, The Mismeasure of Man and Models shows that average score gaps and distribution distances have "almost zero correlation" with top-$k$ selection disparities. It also shows that its rank-biserial index (RABBI) correlates at ≥0.86 with those disparities. It treats the LLM as a black-box scorer. We adopt its metrics as our outcome measures, but we open the box.

On the method side, ASTRA pairs an LLM with a linear-programming solver in negotiation. In ASTRA, though, the LLM only tunes one trade-off scalar inside a human-written template, and fairness across people is never examined. We let the LLM write the whole formulation, and we study how bias enters through that writing.

The model-simplification literature supplies the omission channel. Homsi et al. show that routing models which drop load-dependent fuel use break at real scale (Industrial and Tramp Ship Routing). Biró et al. show that once realistic contract heterogeneity is added to admissions markets, the set of stable outcomes becomes large (The Large Core of College Admission Markets). These papers study whether dropped detail hurts efficiency. None of them asks who absorbs the cost when a modeler, human or LLM, drops it.

Finally, Same Facts, Different Updates shows that the inference setup alone changes how models weigh incidental social information. In half the tested attributes, decisions differed significantly between paired and independent inference. That paper warns us that our pipeline's structure, including whether features are extracted per person in a clean context or in a batch, is itself a variable. We therefore control it explicitly.

Research Program

The pipeline under study has two LLM stages followed by a solver. In the first stage, the model reads a scenario brief and writes a mixed-integer program. The brief describes the resource, the pool, the operational realities, and the stated goals. The program specifies which per-person features matter, their weights, the hard constraints, and which operational factors are modeled. In the second stage, the model reads each person's free-text record and extracts the feature values the program needs. A standard open-source solver then returns the top-$k$ allocation.

The audit runs this pipeline on a scenario and on demographic counterfactuals of it. In a counterfactual, names, pronouns, explicit attributes, and a curated set of proxy cues are swapped, either in the brief or in individual records. Because programs and extracted values are structured, we canonicalize them and compute exact diffs.

We then attribute the change in a disparity measure $D$ to each channel by substitution. Here $D$ is the top-$k$ demographic-parity gap, $\Delta\text{DP}$. Concretely, we hold two of the three components (rule, extracted values, set of modeled factors) at their counterfactually invariant versions, let the third vary, re-solve, and record the change in $D$. We average over orderings in the Shapley style, because the channels may interact.

The omission channel needs a ground-truth reference: a formulation that includes all operational factors stated in the brief. We obtain this by building the scenarios ourselves. For each scenario, a human-written reference program encodes every stated factor, including factors deliberately chosen so that their cost falls unevenly on groups: availability windows, travel distance, documentation requirements, and career-gap handling. Omission disparity is the change in $D$ between solving with the LLM's program and solving with the reference program after restricting both to the same extracted values.

The repair, which we call counterfactually invariant formulation, generates the program and the extractions under a small set of counterfactuals. It keeps each element whose value is stable across them. Elements that vary are replaced: weights by the counterfactual median, extracted values by the median across swapped records, and factors by their inclusion in a majority of variants. The resulting program is then solved.

The key design choice is that invariance is enforced on the shared rule and the per-person values, not on the final ranking. A shared rule applied by a solver treats every candidate identically by construction, so the remaining risk is concentrated where the diff can see it.

The benchmark has three parts. The first is the resume-screening and ICNALE essay-grading tasks from The Mismeasure of Man and Models, recast so that the LLM must write the scoring program rather than score directly. The second extends the two-patient vignettes of Same Facts, Different Updates to multi-patient queues with capacity and scheduling constraints. The third is a new set of shift and service allocation scenarios with reference programs and planted unevenly distributed friction factors. The BBQ demographic categories from BBQ define the swap axes. We run open-weight models, including Llama-3-70B, which The Mismeasure of Man and Models also evaluated, and distilled DeepSeek-R1 variants as in Does Reasoning Introduce Bias?.

Baselines

The naive reference point is direct ranking. The same model reads the brief and all records, reasons step by step, and outputs the top $k$. This is the pipeline most deployments would use. Every other system is measured against its $\Delta\text{DP}$, its gap in equal opportunity ($\Delta\text{EO}$), the rank-biserial correlation from RABBI, and its utility, scored under the reference program.

The strongest existing mitigation is ADBP from Does Reasoning Introduce Bias?. We adapt it to scoring by feeding the reasoning steps back incrementally, detecting score shifts, and triggering re-evaluation. That paper reports that ADBP "increased accuracy by 38–60% in certain scenarios where SfRP corrected 24–44%" on ambiguous BBQ. That figure is a multiple-choice accuracy, not an allocation metric. No reported result on Lacuna was found for ADBP or any reasoning-level debiasing method on top-$k$ allocation disparity, so we establish this number ourselves.

The most dangerous competitor is output-level counterfactual averaging. Here, direct ranking scores are averaged across the same demographic counterfactuals our method uses. It needs no solver and directly targets the swapped attributes.

We also run the naive formulation pipeline without the repair. This tests whether handing the decision to a solver helps by itself. As an upper reference, we solve the human reference program on human-extracted feature values.

The ablations isolate the key ingredient. We run invariance on the rule only, on the extractions only, and on the factor set only. We also run extraction in per-person clean contexts versus a single batch, which tests the context effect reported in Same Facts, Different Updates.

For fairness of comparison, all systems receive the same records, the same counterfactual set where one is used, and a matched budget of LLM calls. Output-level averaging gets as many samples as our method spends on counterfactual formulations. Prompts are tuned on a held-out scenario split with equal effort for every system. We count our method as winning only if it beats output-level averaging and ADBP on $\Delta\text{DP}$ by a margin outside the seed-to-seed and paraphrase variance. We measure that variance because SocialStigmaQA shows swings over ten points from rephrasing alone. The utility loss relative to the naive formulation pipeline must also be no larger than that of the competitors.

Why not just…?

Why not just tell the model to be fair and ignore protected attributes? Instruction-based guardrails weaken as task complexity rises (Uncovering Stereotypes … Task Complexity), and writing an optimization model is a high-complexity task. The fairness-instruction variant of direct ranking is included as a baseline, so the experiments measure this directly instead of assuming it.

Why not just mask demographics before the model sees anything? Models infer status from proxies such as institutional prestige and nationality (Investigating Subtler Biases in LLMs). More importantly, masking cannot address the omission channel. Dropping an availability constraint harms caregivers whether or not the word "caregiver" is visible. Masking is a baseline, and our decomposition will show which channels it leaves intact.

Why not just average direct-ranking scores over counterfactuals and skip the solver? This is a genuine threat. If it matches our method on disparity and utility, then the repair adds nothing as a mitigation. We will report that result and narrow the contribution to the audit. The decomposition would remain useful because output averaging cannot say why a gap exists or detect omission harm.

We expect formulation-level invariance to win for two reasons. First, averaging leaves group-patterned simplifications in place, since all counterfactual rankings share the same dropped factor. Second, averaging has to correct every candidate's score separately, whereas our method corrects a single shared rule. The planted-friction scenarios are designed to separate the two methods on exactly this point.

Why not just evaluate with BBQ-style accuracy or average score gaps? The Mismeasure of Man and Models shows these measures barely track who gets selected. We report $\Delta\text{DP}$, $\Delta\text{EO}$, and the RABBI rank-biserial correlation at fixed $k$. Average gaps are reported only to show where they disagree with these.

Decisive Checks

Three results would settle the claims.

The first concerns localization. Swapping in only the diff-flagged elements should recover most of the counterfactual change in $\Delta\text{DP}$. Swapping in random, unflagged elements of equal number should recover little. If flagged elements do not explain the gap, the central premise fails.

The second concerns omission. In the planted-friction scenarios, omission disparity should be nonzero and should concentrate on the groups the planted factors affect. It should also appear even when identity tokens are masked. This would establish that simplification is a distinct bias channel and not just a re-expression of token-level bias.

The third is the head-to-head comparison. At matched call budgets, the invariant-formulation pipeline should show lower $\Delta\text{DP}$ than output-level averaging and adapted ADBP, at no greater utility loss under the reference program. Results are reported separately for each benchmark and model, with paraphrase-variance intervals.

A negative outcome on the third check combined with a positive one on the first two would still yield a usable result: an auditing method that names the formulation element responsible for an unfair allocation, which no free-text reasoning audit currently provides.