mlsanityData to 7 Oct 2026

The Counterfeit Conundrum: Can Code Language Models Grasp the Nuances of Their Incorrect Generations?

arXiv 2402.19475 ↗First posted 29 Feb 2024cs.SE cs.AI cs.LGcited by 20

Not on the map. Why?

Abstract (arXiv)

While language models are increasingly more proficient at code generation, they still frequently generate incorrect programs. Many of these programs are obviously wrong, but others are more subtle and pass weaker correctness checks such as being able to compile. In this work, we focus on these counterfeit samples: programs sampled from a language model that 1) have a high enough log-probability to be generated at a moderate temperature and 2) pass weak correctness checks. Overall, we discover that most models have a very shallow understanding of counterfeits through three clear failure modes. First, models mistakenly classify them as correct. Second, models are worse at reasoning about the execution behaviour of counterfeits and often predict their execution results as if they were correct. Third, when asking models to fix counterfeits, the likelihood of a model successfully repairing a counterfeit is often even lower than that of sampling a correct program from scratch. Counterfeits also have very unexpected properties: first, counterfeit programs for problems that are easier for a model to solve are not necessarily easier to detect and only slightly easier to execute and repair. Second, counterfeits from a given model are just as confusing to the model itself as they are to other models. Finally, both strong and weak models are able to generate counterfeit samples that equally challenge all models. In light of our findings, we recommend that care and caution be taken when relying on models to understand their own samples, especially when no external feedback is incorporated.

Key facts. Cited by 20 papers in the map (data through 7 Oct 2026). Builds on 45 of its 67 references that are in the map. First posted on arXiv 29 Feb 2024.

Builds on

45 of 67 references.

References · 45

  1. 2021Training Verifiers to Solve Math Word Problemscited by 9,743
  2. 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
  3. 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
  6. 2023Let's Verify Step by Stepcited by 3,598
  7. 2021Program Synthesis with Large Language Modelscited by 3,509
  8. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
  9. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  10. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  11. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
  12. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
33 more
  1. 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 965
  2. 2023Teaching Large Language Models to Self-Debugcited by 963
  3. 2023Math-Shepherd: Verify and Reinforce LLMs Step-by-step without Human Annotationscited by 895
  4. 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
  5. 2023StarCoder: may the source be with you!cited by 790
  6. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  7. 2022CodeT: Code Generation with Generated Testscited by 369
  8. 2023State of What Art? A Call for Multi-Prompt LLM Evaluationcited by 299
  9. 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
  10. 2023Reasoning or Reciting? Exploring the Capabilities and Limitations of Language Models Through Counterfactual Taskscited by 243
  11. 2023Universal Self-Consistency for Large Language Model Generationcited by 198
  12. 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
  13. 2023Solving Challenging Math Word Problems Using GPT-4 Code Interpreter with Code-based Self-Verificationcited by 166
  14. 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 110
  15. 2023Can Large Language Models Really Improve by Self-critiquing Their Own Plans?cited by 107
  16. 2024Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineeringcited by 100
  17. 2023The Generative AI Paradox: "What It Can Create, It May Not Understand"cited by 97
  18. 2022Execution-Based Evaluation for Open-Domain Code Generationcited by 89
  19. 2023GPT-4 Doesn't Know It's Wrong: An Analysis of Iterative Prompting for Reasoning Problemscited by 88
  20. 2023LLMs cannot find reasoning errors, but can correct them given the error locationcited by 85
  21. 2022Coder Reviewer Reranking for Code Generationcited by 83
  22. 2023Enhancing Large Language Models in Coding Through Multi-Perspective Self-Consistencycited by 46
  23. 2024When is Tree Search Useful for LLM Planning? It Depends on the Discriminatorcited by 46
  24. 2023ALGO: Synthesizing Algorithmic Programs with LLM-Generated Oracle Verifierscited by 41
  25. 2023Beyond Accuracy: Evaluating Self-Consistency of Code Large Language Models with IdentityChaincited by 31
  26. 2023The Larger They Are, the Harder They Fail: Language Models do not Recognize Identifier Swaps in Pythoncited by 29
  27. 2023Large Language Models of Code Fail at Completing Code with Potential Bugscited by 28
  28. 2019ATOM: Commit Message Generation Based on Abstract Syntax Tree and Hybrid Rankingcited by 25
  29. 2021CoDesc: A Large Code-Description Parallel Datasetcited by 23
  30. 2024NoFunEval: Funny How Code LMs Falter on Requirements Beyond Functional Correctnesscited by 23
  31. 2023A large language model-assisted education tool to provide feedback on open-ended responsescited by 21
  32. 2023Towards LLM-based Autograding for Short Textual Answerscited by 20
  33. 2024The Generative AI Paradox on Evaluation: What It Can Solve, It May Not Evaluatecited by 16

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 9; 2025: 8; 2026: 3.

20 papers.

Sort:

By area:

  1. 2025R2E-Gym: Procedural Environments and Hybrid Verifiers for Scaling Open-Weights SWE Agentscited by 140
  2. 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 133
  3. 2024Small Language Models Need Strong Verifiers to Self-Correct Reasoningcited by 85
  4. 2024Formal Mathematical Reasoning: A New Frontier in AIcited by 80
  5. 2024CodeJudge-Eval: Can Large Language Models be Good Judges in Code Understanding?cited by 29
  6. 2024What Makes Large Language Models Reason in (Multi-Turn) Code Generation?cited by 29
  7. 2025SWE-Synth: Synthesizing Verifiable Bug-Fix Data to Enable Large Language Models in Resolving Real-World Bugscited by 22
  8. 2024Learning Code Preference via Synthetic Evolutioncited by 19
  9. 2024MdEval: Massively Multilingual Code Debuggingcited by 16
  10. 2024LLM-Powered Test Case Generation for Detecting Bugs in Plausible Programscited by 14
  11. 2025ReliableEval: A Recipe for Stochastic LLM Evaluation via Method of Momentscited by 10
  12. 2025Are Large Language Models Robust in Understanding Code Against Semantics-Preserving Mutations?cited by 7
8 more
  1. 2024Specify What? Enhancing Neural Specification Synthesis by Symbolic Methodscited by 6
  2. 2025IFEvalCode: Controlled Code Generationcited by 5
  3. 2025XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistantscited by 4
  4. 2025PromptSuite: A Task-Agnostic Framework for Multi-Prompt Generationcited by 3
  5. 2026Self-Execution Simulation Improves Coding Modelscited by 2
  6. 2025Success is in the Details: Evaluate and Enhance Details Sensitivity of Code LLMs through Counterfactualscited by 1
  7. 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
  8. 2026On the Robustness of LLMs' Internal Representation of Code Correctnesscited by 1