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

Alex Gu, Wen-Ding Li, Naman Jain, Theo X. Olausson, Celine Lee +2 more
2/29/2024
cs.SEcs.AIcs.LG

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{gu2024counterfeit,
  title  = {The Counterfeit Conundrum: Can Code Language Models Grasp the Nuances of Their Incorrect Generations?},
  author = {Alex Gu and Wen-Ding Li and Naman Jain and Theo X. Olausson and Celine Lee and Koushik Sen and Armando Solar-Lezama},
  year   = {2024},
  eprint = {2402.19475},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.19475v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.19475.svg)](https://codeofpaper.com/paper/2402.19475)

Discussion