The Commonplace
Home 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 →

Code-generating LLMs reproduce buggy lines more often than fixes, and having seen buggy variants in training amplifies this bias; likelihood scoring usually favors fixes but some metrics flip preference when the bug alone was seen, suggesting memorised errors can skew evaluations and risk propagation in practice.

Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMs
Ali Al-Kaswan, Claudio Spiess, Prem Devanbu, Arie van Deursen, Maliheh Izadi · January 15, 2026
arxiv correlational 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. Ali Al-Kaswan unresolved corpus identity
  2. Claudio Spiess unresolved corpus identity
  3. Prem Devanbu unresolved corpus identity
  4. Arie van Deursen unresolved corpus identity
  5. Maliheh Izadi unresolved corpus identity

Semantic Scholar

Latest observation:

  1. Ali Al-Kaswan provider ID
  2. Claudio Spiess provider ID
  3. P. Devanbu provider ID
  4. A. Deursen provider ID
  5. M. Izadi provider ID
Models tend to reproduce buggy lines more often than fixed code, and prior exposure to buggy variants amplifies that tendency while likelihood-based metrics often still prefer the fixes.

Citation observations

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

Large language models are increasingly used for code generation and debugging, but their outputs can still contain bugs, that originate from training data. Distinguishing whether an LLM prefers correct code, or a familiar incorrect version might be influenced by what it's been exposed to during training. We introduce an exposure-aware evaluation framework that quantifies how prior exposure to buggy versus fixed code influences a model's preference. Using the ManySStuBs4J benchmark, we apply Data Portraits for membership testing on the Stack-V2 corpus to estimate whether each buggy and fixed variant was seen during training. We then stratify examples by exposure and compare model preference using code completion as well as multiple likelihood-based scoring metrics We find that most examples (67%) have neither variant in the training data, and when only one is present, fixes are more frequently present than bugs. In model generations, models reproduce buggy lines far more often than fixes, with bug-exposed examples amplifying this tendency and fix-exposed examples showing only marginal improvement. In likelihood scoring, minimum and maximum token-probability metrics consistently prefer the fixed code across all conditions, indicating a stable bias toward correct fixes. In contrast, metrics like the Gini coefficient reverse preference when only the buggy variant was seen. Our results indicate that exposure can skew bug-fix evaluations and highlight the risk that LLMs may propagate memorised errors in practice.

Summary

Main Finding

The paper introduces an exposure-aware evaluation framework and shows that prior exposure to buggy or fixed code in training data materially skews LLM behaviour and evaluation. While likelihood-based metrics (notably min/max token probability) tend to prefer the correct fixed code, LLM generations reproduce buggy lines far more often than fixes — especially when the model was exposed to the buggy variant during training. Exposure therefore can drive propagation of memorised errors and can confound evaluations of model correctness.

Key Points

  • Exposure-aware pipeline: The authors sample single-line bug–fix pairs (ManySStuBs4J) and use membership testing (Data Portraits on Stack-v2) to determine whether the buggy and/or fixed variant was present in training data. Samples are stratified into four exposure classes: neither seen, both seen, only bug seen, only fix seen.
  • Datasets: ManySStuBs4J (16,899 Java single-statement bug–fix pairs) and Stack-v2 (training corpus represented via a Data Portrait).
  • Models evaluated: open models trained (at least partly) on Stack-v2 — StarCoder2 family (3B, 7B, 15B), Mellum-4B (open weights, partially undisclosed data but includes Stack-v2), and SmolLM3-3B.
  • Membership testing (Data Portraits): uses strided Bloom filters with n-gram width w = 50 and stride s = 50; to avoid false negatives queries are padded to ≥99 tokens; badness score = fraction of n-grams found; threshold ≥90% badness used to mark a snippet as “seen”.
  • Two evaluation modes:
    • Likelihood-based scoring from token conditional probabilities (various metrics: perplexity, mean token prob, min/max token prob, Gini coefficient, etc.).
    • Actual generation/completion behaviour and verbatim matching to bug or fix.
  • Main empirical findings:
    • About 67% of SStuBs pairs have neither variant present in Stack-v2 (i.e., likely unseen).
    • When only one variant is present, fixes are more often present than bugs.
    • In generations, models reproduce buggy lines far more often than fixes. Exposure to the buggy variant markedly increases bug-regurgitation rates; exposure to fixes yields only marginal improvement in fix generation.
    • Likelihood metrics are heterogeneous: minimum and maximum token-probability metrics consistently prefer the fixed code across exposure conditions (a stable bias toward correct fixes), but distributional metrics like the Gini coefficient can reverse preference when only the buggy variant was seen.
    • Preferences vary by bug category: some categories are robust to exposure, others highly susceptible to memorised propagation; a few show intrinsic bug preference.
  • Contributions:
    • An exposure-aware evaluation methodology for bug-vs-fix preference.
    • Empirical quantification of how exposure affects generation and likelihood-based scoring.
    • Analysis of metric sensitivity and breakdown by bug type.

Data & Methods

  • Data:
    • ManySStuBs4J: 16,899 single-statement Java bug–fix pairs (processed with extra metadata).
    • Stack-v2: 68TB public code corpus; a 90GB Data Portrait (Bloom-filter-based) represents sampled 50-token n-grams.
  • Membership inference:
    • Data Portraits check presence via hashed 50-token n-grams at 50-token stride.
    • To ensure sound queries, each SStuB snippet was padded to ≥99 tokens using surrounding context (padding on both sides to improve hit coverage).
    • Badness score is fraction of sampled n-grams matched; threshold of ≥90% marks a snippet as seen.
    • Caveats: Bloom filters can yield false positives (though tuned to ~0.1% FPR); stride/window construction can produce false negatives for short/unaligned snippets — mitigated by padding but still a methodological limitation.
  • Evaluation pipeline:
    • Stratify SStuBs into four exposure groups: neither, both, only bug, only fix.
    • For each model and SStuB pair:
      • Compute conditional token probabilities for the bug and fix given identical preceding context.
      • Compute multiple metrics from the token-prob sequences (perplexity, mean token prob, min/max token prob, Gini coefficient, length baselines).
      • Generate completions under decoding; check verbatim match rates to bug or fix lines.
    • Aggregate comparisons across exposure strata and by bug category to study effects and robustness.
  • Models: open-weight models up to 20B parameters; training-data openness varies (StarCoder2 fully open-data on Stack-v2; Mellum includes Stack-v2 but has closed components; SmolLM3 uses Stack-v2 among public sources).

Implications for AI Economics

  • Measurement and Benchmarking:
    • Evaluation inflation risk: benchmark scores (and perceived competence) can be inflated or distorted when models memorise test items — especially when fixes are present in training data more often than bugs or vice versa. This undermines the reliability of benchmarks used for product differentiation, contracting, or procurement.
    • Metric choice matters: different likelihood metrics give divergent conclusions; purchasers and regulators should standardise metrics that are robust to memorisation effects (e.g., the paper finds min/max token-prob metrics more stable).
  • Product Quality, Liability, and Externalities:
    • Propagation of memorised bugs creates negative externalities: widespread use of LLM-generated code that regurgitates buggy patterns can introduce systemic costs (security incidents, debugging time, downstream failures) that accrue across firms and projects.
    • Liability and risk pricing: service providers and customers need to price in the risk of memorised bugs. If models are more likely to reproduce observed buggy patterns, downstream debugging costs and potential legal exposure rise — affecting insurance, SLAs, and commercial terms.
  • Incentives for Data Governance:
    • Providers have incentives to curate training data to reduce memorised harmful patterns, but this is costly. The study strengthens the economic argument for dataset hygiene, provenance tracking, and selective exclusion (or targeted mitigation) of known-bad code.
    • Data disclosure and auditing: economic actors (enterprises, auditors, regulators) may demand greater transparency on training corpora or access to exposure tests (e.g., Data Portraits) to assess memorisation risk. This creates market value for third-party auditing services and tools.
  • Labor and Productivity Effects:
    • Short-term productivity gains from LLM-assisted coding could be offset by increased debugging and security-fix costs if models memorise and propagate bugs. Firms should consider investment in verification tooling and human oversight, affecting labor allocation between coding and QA.
  • Market Design & Competition:
    • Open-data models permit reproducible exposure analyses (as in this paper); closed-data models make it harder to detect memorisation and thus may command different risk premia. This could influence procurement choices and market competition.
  • Policy implications:
    • Regulating training-set hygiene or requiring disclosure of known exposures for sensitive domains (e.g., security-critical codebases) could reduce negative externalities but will impose compliance costs.
    • Standardising exposure-aware evaluation in model certification regimes can improve social welfare by aligning incentives for safer model deployment.

Limitations (relevant to economic interpretation) - Membership inference using Data Portraits is probabilistic (Bloom-filter FPs, stride-induced FNs mitigated by padding) — exposure labels are estimates, not absolute facts. - Analysis is limited to single-statement Java SStuBs and models up to 20B parameters; broader languages, multi-line bugs, and larger closed models may exhibit different dynamics. - Only specific metrics and matching criteria were tested; other evaluation designs could yield additional nuance.

Overall, the paper shows that training-data exposure is a first-order factor affecting whether LLMs “see” bugs and then “do” (regurgitate) them. For AI economics, that implies measurable downstream costs, altered incentives for data curation and disclosure, and the need for exposure-aware auditing and benchmarks when valuing, procuring, or regulating code-generating LLMs.

Assessment

Paper Typecorrelational Evidence Strengthmedium — Findings are consistent across multiple scoring metrics and generative experiments on a large benchmark of real bug/fix pairs, showing systematic patterns (models reproduce bugs more often; exposure amplifies this). However, training-set membership is estimated (membership tests are imperfect), exposure is not experimentally manipulated, and the analysis is limited to a single bug benchmark and a specific corpus for membership testing, so causal claims about exposure are suggestive rather than definitive. Methods Rigormedium — The study uses a careful exposure-aware design, membership testing, stratification, multiple complementary metrics (generation and likelihood-based measures) and a recognized bug-fix benchmark, which is rigorous for observational work; nevertheless, reliance on approximate membership inference, potential false positives/negatives in exposure labels, limited details on model diversity (training regimes, sizes), and lack of experimental variation reduce methodological certainty. SampleManySStuBs4J benchmark of buggy vs fixed Java code snippets; membership testing performed against the Stack-V2 corpus using Data Portraits to estimate whether each buggy or fixed variant was present in training; models evaluated via code completion generations and several likelihood-based scoring metrics (minimum/maximum token probability, Gini coefficient, etc.); reported summary that 67% of examples had neither variant present and that fixes were more often present than bugs when only one variant was seen. Themeshuman_ai_collab productivity IdentificationEstimate whether buggy and fixed code variants were present in the model's training data using membership testing (Data Portraits) on the Stack-V2 corpus, stratify ManySStuBs4J examples by exposure status (neither seen, only bug seen, only fix seen, both seen) and compare model behavior across strata using code completions and multiple likelihood-based scoring metrics (min/max token probability, Gini coefficient, etc.); no randomized or exogenous variation is introduced, identification is observational and based on stratification by estimated exposure. GeneralizabilityUses a single bug-fix benchmark (ManySStuBs4J) focused on Java — results may not generalize to other languages, bug types, or larger system-level bugs, Membership testing is performed on Stack-V2 only; other training corpora or different dataset curation could change exposure labels, Evaluations appear limited to the set of models tested (unspecified here); different model architectures, sizes, or training procedures may behave differently, Observational design limits causal generalization — exposure estimates may be noisy and confounded with other factors (e.g., prevalence of patterns), Likelihood metrics and generation settings chosen may influence results; production deployment contexts (prompting, retrieval, fine-tuning, guardrails) could alter behavior

Claims (10)

ClaimDirectionOutcomeConfidence & EvidenceDetails
We introduce an exposure-aware evaluation framework that quantifies how prior exposure to buggy versus fixed code influences a model's preference. Other null_result influence of prior exposure on model preference between buggy and fixed code
Reading fidelity high
Study strength medium
not reported
0.3
Using the ManySStuBs4J benchmark, we apply Data Portraits for membership testing on the Stack-V2 corpus to estimate whether each buggy and fixed variant was seen during training. Other null_result membership/exposure of buggy and fixed code variants in training data
Reading fidelity high
Study strength medium
not reported
0.3
Most examples (67%) have neither variant in the training data. Other null_result proportion of examples with neither buggy nor fixed variant present in training data
Reading fidelity high
Study strength medium
67%
0.3
When only one variant is present, fixes are more frequently present than bugs. Other positive relative frequency of fixed vs buggy variants present in training data when only one is present
Reading fidelity high
Study strength medium
not reported
0.3
In model generations, models reproduce buggy lines far more often than fixes. Output Quality negative frequency of generated buggy lines versus generated fixed lines
Reading fidelity high
Study strength medium
not reported
0.3
Bug-exposed examples amplify this tendency (models reproducing buggy lines), and fix-exposed examples show only marginal improvement. Output Quality negative change in generation preference (buggy vs fixed) conditional on exposure type
Reading fidelity high
Study strength medium
not reported
0.3
In likelihood scoring, minimum and maximum token-probability metrics consistently prefer the fixed code across all conditions. Output Quality positive preference indicated by min/max token-probability metrics (fixed vs buggy)
Reading fidelity high
Study strength medium
not reported
0.3
Metrics like the Gini coefficient reverse preference when only the buggy variant was seen. Output Quality negative preference reversal (fixed vs buggy) indicated by Gini coefficient under buggy-only exposure
Reading fidelity high
Study strength medium
not reported
0.3
Exposure can skew bug-fix evaluations and highlight the risk that LLMs may propagate memorised errors in practice. Output Quality negative risk of LLMs propagating memorised buggy code; skewing of evaluation results by exposure
Reading fidelity high
Study strength medium
not reported
0.3
We stratify examples by exposure and compare model preference using code completion as well as multiple likelihood-based scoring metrics. Other null_result model preference across evaluation methods conditional on exposure
Reading fidelity high
Study strength medium
not reported
0.3

Notes