The Commonplace
Home Three-study pilot Papers Evidence Explore Trends Syntheses Digests References Docs 🎲 Workforce Futures
← Papers
Direction, evidence grade, and study type are AI-generated labels (gpt-5-mini), not human-verified. Syntheses are LLM-written. "Tensions" are machine-detected candidates, not confirmed contradictions. A research-acceleration tool, not peer review. How this is built →

Large language models routinely propose bogus optimizations for already-optimal code, but a simple confidence-threshold prompt halves over-editing without reducing correct fixes on improvable snippets; in a 180-trial pilot across nine models the IIV penalty raised abstention from 0% to 44.4% while keeping false abstentions at 0%.

Efficiency Hallucination: Formalizing and Measuring Behavioral Calibration in LLM-Based Code Optimization
Sarah Wilson, Gail Kaiser, Patrick Musau · September 13, 2026
arxiv quasi_experimental medium evidence 7/10 relevance Full text usable extracted full text Source PDF

Structured author observations

Linked only from stored provider relations; the raw author line above is never matched by name.

Arxiv

Latest observation:

  1. Sarah Wilson unresolved corpus identity
  2. Gail Kaiser unresolved corpus identity
  3. Patrick Musau unresolved corpus identity

Semantic Scholar

Latest observation:

  1. Sarah Wilson unresolved corpus identity
  2. Gail E. Kaiser provider ID
  3. Patrick Musau provider ID
LLMs systematically produce unnecessary edits on already-optimal code (100% over-edit under standard prompts), but adding a 90%-confidence 'IIV penalty' prompt raises correct abstention to 44.4% while preserving 100% edits on genuinely improvable code in this pilot.

Citation observations

Cumulative provider counts captured on specific dates; providers are never combined.

The integration of Large Language Models (LLMs) into automated code optimization introduces a critical reliability risk we term the Efficiency Hallucination: an LLM's tendency to issue non-functional mutations with unsubstantiated performance claims on already-optimized code. This is driven by the Evaluation Trap, wherein binary benchmarks incentivize unnecessary modifications over safely abstaining. We present a validation framework using classification penalty methods, evaluated across 180 optimization runs on nine models (GPT, Claude, Gemini) using EffiBench. Under standard prompts, models exhibit a 100% over-edit rate on optimal code. Our guardrail raises correct abstention from 0% to to 44.4%, preserving a 100% edit rate on sub-optimal code with zero false abstentions. Calibration is uneven: GPT-5.4 Mini approaches near-perfect abstention, and simple code is recognized more reliably than complex code. Our framework offers a training-free mechanism to mitigate LLM overconfidence before deployment in production.

Summary

Main Finding

LLMs used for automated code optimization systematically "bluff" when presented with already-optimal code: under standard prompts every tested model edited optimal code (100% over-edit rate). Introducing a simple, training-free inference-time guardrail (an IIV penalty prompt requiring >90% confidence to suggest edits) raised correct abstention on optimal code to 44.4% while preserving 100% edit rate on genuinely improvable code and producing 0% false abstentions. Behavioral calibration (the wisdom to abstain) is therefore an orthogonal reliability property that can be measured and partially mitigated at inference time, but residual hallucination risk remains and varies strongly by model and problem.

Key Points

  • Efficiency Hallucination: LLMs confidently propose non-beneficial or unverifiable optimizations on already-optimal code; these edits typically compile and pass tests, making them invisible to functional-only evaluation.
  • Evaluation Trap: Binary benchmarks (pass/fail + runtime checks only on improvable code) create asymmetric incentives—admit optimality gives zero credit while bluffing is low-risk—mathematically amplified by the IIV framework (generative error ≥ 2 × misclassification rate).
  • Behavioral Calibration taxonomy: four outcomes — true edit, true abstention, over-edit (false positive), false abstention (false negative). Perfect calibration = edit on all suboptimal + abstain on all optimal.
  • IIV penalty (Optimal Baseline): an inference-time prompt that instructs the model to output ALREADY_OPTIMAL unless it is >90% confident an edit improves speed; this adds a negative signal for Error-class outputs without retraining.
  • Empirical summary (180 trials; 9 models; EffiBench optimal vs suboptimal snippets):
    • Control (standard prompt): 100% edit rate on optimal code (i.e., 100% bluff/over-edit).
    • IIV penalty: abstention on optimal code rose to 44.4% (over-edit fell to 55.6%); edit rate on suboptimal code remained 100%; false abstentions = 0%.
    • Model heterogeneity: GPT-5.4-mini achieved 100% abstention on optimal snippets under penalty; family averages — Claude 53%, GPT 53%, Gemini 27%. Larger/more costly models sometimes showed worse calibration.
    • Per-problem variation: abstention rates on optimal code ranged from 89% (Remove Duplicates from Sorted Array II) to 11% (Finding 3-Digit Even Numbers). Surface complexity increases hallucination risk.

Data & Methods

  • Dataset: 5 paired problems from EffiBench (each with an EffiBench top-percentile "optimal" snippet and a functionally correct but degraded "sub-optimal" snippet), covering algorithms like two-pointer sweeps, recursion, backtracking, bit-manipulation, and nested loops.
  • Models: nine LLM variants across three families (Claude, Gemini, GPT) — each model run on 20 trials (5 optimal × 2 conditions + 5 suboptimal × 2 conditions) → total N = 180.
  • Conditions:
    • Control: standard prompt "Optimize this code for execution speed."
    • IIV Penalty: Penalty Prompt: "Only suggest an edit if you are >90% confident it improves execution speed; otherwise, output ALREADY_OPTIMAL."
  • Metrics: Edit (true positive), Abstention (true negative), Over-Edit (false positive / Efficiency Hallucination), False Abstention (false negative). Measured proportions per model, per family, and per problem.
  • Key quantitative outcomes:
    • Control: optimal-code edit rate = 100%, suboptimal-code edit rate = 100%.
    • IIV penalty: overall optimal-code abstention = 44.4%; over-edit = 55.6%; suboptimal edit = 100%; false abstention = 0%.
    • Per-model abstention (IIV): GPT-5.4-mini 100%; GPT-5.4 20%; GPT-5 Mini 40%; Gemini models 0–60%; Claude models 40–60%.
    • Per-problem abstention (IIV across models): Remove Duplicates 89%, Is Same Tree 56%, Min Ops 44%, Combination Sum II 22%, Finding 3-Digit Even Numbers 11%.

Implications for AI Economics

  • Incentive Alignment & Benchmark Design
    • Current benchmarks misalign incentives by omitting negative signals for non-beneficial edits; economic actors procuring code-optimization tooling should demand evaluation on Optimal Baselines (top-percentile solutions) to quantify bluff risk.
    • Vendors and evaluators should incorporate abstention-calibration metrics into SLAs and product comparisons; models with similar speedup capability may differ substantially in the costs they impose via false “improvements.”
  • Hidden Operational Costs
    • Over-edits generate non-trivial economic costs: reviewer time, CI churn, latent technical debt, slower release cycles, and erosion of trust in automation. These costs can outweigh nominal speedup gains from rare correct optimizations.
    • The finding that lighter/cheaper models can be better calibrated (and thus cheaper in total cost of ownership for certain pipelines) suggests procurement should consider calibration-adjusted cost rather than raw model size or headline capability.
  • Product & Market Effects
    • There is room for new market services: calibration evaluation suites, runtime-verification integration (to ensure claimed speedups actually materialize), and certification services for abstention/behavioral calibration.
    • Model pricing and tiering may shift: buyers may prefer smaller, well-calibrated models for localized optimization tasks and reserve larger models for exploration/agentic search where hallucination risk is acceptable and verification pipelines exist.
  • Deployment Strategies & Risk Management
    • Low-cost, inference-time guardrails (penalty prompts) are an immediate mitigation that preserves capability while reducing over-edits; however, they are not fully sufficient—residual over-edit rates persist and vary by task.
    • Runtime verification (measuring execution speed of candidate edits) and CI-level performance checks should be standard for production deployment of optimization agents to convert probabilistic abstention signals into deterministic guarantees.
    • Procurement contracts and internal policies should account for calibration trade-offs: require zero or low false abstention and quantify acceptable bluff rates.
  • Training & R&D Incentives
    • There is an economic case for training/fine-tuning objectives that penalize over-editing or explicitly teach abstention (e.g., RLHF with abstention utility), which could become a competitive differentiator.
    • Benchmarks must evolve: include Optimal Baselines, abstention targets, and cost-aware utility functions to reflect real-world economic harms of hallucinated edits.
  • Policy & Liability
    • For organizations with regulatory or safety exposure, model calibration metrics could inform audit trails and contractual liability; insurers and regulators may start to require calibration evidence for automated code-change systems.

Limitations and caveats relevant for economic decisions - This is a controlled, small-scale pilot (180 trials, 5 problems); broader datasets, agentic systems, and full-codebase evaluations may yield different bluff dynamics. - The IIV penalty is inference-only and does not eliminate hallucinations—runtime verification and pipeline safeguards are necessary for high-assurance deployment. - Model behavior may change with newer architectures, fine-tuning for abstention, or with agentic wrappers that include search and verification loops; economic trade-offs should be revisited as tooling evolves.

Bottom line for practitioners and purchasers: measure and price calibration, not just raw capability. Simple, low-cost guardrails reduce hallucination-induced operational costs substantially, but lasting economic solutions require benchmark redesign, runtime verification, and possibly new model training objectives that internalize the cost of false positive optimizations.

Assessment

Paper Typequasi_experimental Evidence Strengthmedium — The study provides direct empirical contrasts (control vs penalty) across nine contemporary LLMs and paired optimal/sub-optimal snippets, showing large, consistent behavioral shifts; however it is a small, focused pilot (5 problems, 180 trials), uses synthetic/subset problems (LeetCode/EffiBench snippets), and lacks broader replication, long-run deployment data, and external execution-based verification of claimed speedups. Methods Rigormedium — Design strengths include paired optimal/sub-optimal examples, within-model comparisons, and multi-model coverage; weaknesses include small problem set, possible selection bias in chosen snippets, sub-optimal variants generated by a single model then human-verified (potentially non-representative), absence of statistical testing or uncertainty intervals, no runtime-execution verification of claims, and evaluation limited to API calls (not integrated agent pipelines). Sample180 trials total: nine models from three families (Claude: opus-4.7-fast, opus-4.8, sonnet-4.5; Gemini: gemini-3-flash-preview, gemini-3.1-pro-preview, gemini-3.5-flash; GPT: gpt-5-mini, gpt-5.4-mini, gpt-5.4). Each model received 20 trials (5 optimal snippets × 2 conditions + 5 sub-optimal × 2 conditions). Snippets are paired optimal (EffiBench top-percentile human solutions) and sub-optimal (Gemini-3.5-flash generated then human-verified) drawn from five LeetCode-style problems; evaluation compares control prompt vs IIV penalty prompt via API calls. Themeshuman_ai_collab productivity adoption governance IdentificationWithin-model, within-problem paired comparison: each model received both control (standard optimization prompt) and treatment (IIV penalty prompt) on matched optimal and sub-optimal code snippets, allowing measurement of causal effect of the penalty prompt on abstention/edit rates; no randomization beyond balanced trial assignment and no external runtime verification of claimed speedups. GeneralizabilitySmall, non-representative problem set (five LeetCode-style snippets) — results may not generalize to larger, real-world codebases or other problem types., Sub-optimal variants were generated by a single model and human-verified, which may not capture realistic developer errors or diverse sub-optimal patterns., Evaluation restricted to API-level LLM calls; does not test agentic or multi-iteration optimization systems used in production pipelines., No external runtime verification of claimed speedups — abstention/edit labels rely on construction of 'optimal' vs 'sub-optimal' rather than measured execution improvements., Limited language/environment scope (likely Python snippets) and specific LLM versions — results may change with model updates or different languages., Small per-model sample (n=5 per condition per snippet) limits statistical power and detection of rare behaviors.

Claims (9)

ClaimDirectionOutcomeConfidence & EvidenceDetails
Under the standard control prompt, every tested model modified already-optimal code, producing a 100% edit rate and zero abstentions. Error Rate negative Over-editing of already-optimal code
Reading fidelity high
Study strength medium
n=45
100% edit rate; 0% abstention rate
0.48
The IIV penalty prompt increased correct abstention on optimal code from 0% to 44.4% and reduced over-editing from 100% to 55.6%. Error Rate positive Correct abstention and over-edit rate on optimal code
Reading fidelity high
Study strength medium
n=45
abstention increased from 0% to 44.4%; over-editing decreased from 100% to 55.6%
0.48
The IIV penalty preserved a 100% edit rate on sub-optimal code while producing zero false abstentions. Task Completion Time positive Correct edits and false abstentions on sub-optimal code
Reading fidelity high
Study strength medium
n=45
100% edit rate; 0% false-abstention rate
0.48
The pilot study evaluated 180 trials involving nine models from three LLM families, five paired optimization problems, and two prompt conditions. Other null_result Study coverage and experimental sample
Reading fidelity high
Study strength medium
n=180
0.48
GPT-5.4 Mini achieved perfect abstention on optimal code under the IIV penalty, abstaining in all five of its optimal-code trials. Error Rate positive Calibrated abstention on optimal code
Reading fidelity high
Study strength low
n=5
100% abstention; 5/5 trials
0.24
Calibration varied substantially across model families: Claude and GPT had 53% abstention on optimal code under the penalty, while Gemini had 27%. Error Rate mixed Calibrated abstention on optimal code
Reading fidelity high
Study strength low
n=45
Claude 53%; GPT 53%; Gemini 27%
0.24
Abstention on optimal code varied by problem from 11% to 89% under the IIV penalty. Error Rate mixed Problem-specific calibrated abstention
Reading fidelity high
Study strength low
n=45
11% to 89% abstention
0.24
Remove Duplicates from Sorted Array II was the easiest problem for models to recognize as already optimal, with 8 of 9 models abstaining correctly, whereas Finding 3-Digit Even Numbers had the highest over-edit rate, with only 1 of 9 models abstaining. Error Rate mixed Correct abstention by optimization problem
Reading fidelity high
Study strength low
n=18
89% versus 11% abstention
0.24
Within the GPT and Gemini families, lighter models showed higher abstention rates than some larger or more expensive variants on the tested problems. Error Rate negative Model calibration, measured as abstention on optimal code
Reading fidelity high
Study strength low
n=20
GPT-5.4 Mini 100% versus GPT-5.4 20%; Gemini-3 Flash Preview 60% versus Gemini-3.1 Pro Preview 20%
0.24

Notes