<story><title>Study finds AI assistants help developers produce code likely to be buggy</title><url>https://www.theregister.com/2022/12/21/ai_assistants_bad_code/</url></story><parent_chain><item><author>digitalsushi</author><text>If I had a little robot riding in the passenger seat that could tell me whether to go left, straight, or right, and it was correct 90% of the time, I&amp;#x27;d think that was pretty great. I&amp;#x27;d get where I needed to be, even with a couple mishaps.&lt;p&gt;ML code suggestions are the same thing to me. If I don&amp;#x27;t know where I am going, I can just ask it for suggestions.  And it&amp;#x27;s probably going to be what I want.&lt;p&gt;In both cases, I am annoyed with myself for having started before I knew where I want to end up.</text></item><item><author>lumb63</author><text>Surprising. If only there were a way that we could have foreseen that an AI trained to write code in part by looking at people who, self-admittedly, don’t know how to write code, and people who write code for others with minimal context (Stack Overflow), would produce buggy code. It is a case of GIGO.&lt;p&gt;Most developers do not learn much from Stack Overflow. Why do we expect AI to fare better? In my experience, one in ten (optimistically) Stack Overflow answers give anything more than a code snippet with enough information to get the asker through their immediate issue. It can be beneficial if you have the necessary understanding already and only want the code snippet, but this is no way for humans or machines to learn.&lt;p&gt;Also, having an “AI Assistant” must lower programmers’ guards against buggy code. After all, it is an assistant - it must assist you, right? Subordinating humans to machines will not work in this domain until there is better training data and the machines can be taught the reason they are writing specific code. Until then, I have low hopes for AI-generated code.&lt;p&gt;Even if AI could generate correct, bug-free code the majority (say 99.9% of the time), I expect finding and correcting bugs will be difficult for humans. For example, how many bugs are found and corrected by the author of code during development, versus how many in peer review? I’m reminded of a saying akin to “ask someone to review 5,000 lines of code: no bugs. Ask someone to review 5 lines of code: 5 bugs”. We are poor critical reviewers, and AI cannot fix that. AI assistants probably worsen reviews, because reviewers will expect high-quality code from their AI assistants.</text></item></parent_chain><comment><author>Salgat</author><text>The problem with ML is that it&amp;#x27;s pattern recognition, it&amp;#x27;s an approximation. Code is absolute, it&amp;#x27;s logic that is interpreted very literally and very exactly. This is what makes it so dangerous for coding; it creates code that&amp;#x27;s convincing to humans but with deviations that allow for all sorts of bugs. And the worst part is, since you didn&amp;#x27;t write the code, you may not have the skills (or time) to figure out if those bugs exist, especially if the ML is extremely convincing&amp;#x2F;clever in what it writes. I would argue that this overhead is even worse for productivity over just writing it yourself.</text></comment>
<story><title>Study finds AI assistants help developers produce code likely to be buggy</title><url>https://www.theregister.com/2022/12/21/ai_assistants_bad_code/</url></story><parent_chain><item><author>digitalsushi</author><text>If I had a little robot riding in the passenger seat that could tell me whether to go left, straight, or right, and it was correct 90% of the time, I&amp;#x27;d think that was pretty great. I&amp;#x27;d get where I needed to be, even with a couple mishaps.&lt;p&gt;ML code suggestions are the same thing to me. If I don&amp;#x27;t know where I am going, I can just ask it for suggestions.  And it&amp;#x27;s probably going to be what I want.&lt;p&gt;In both cases, I am annoyed with myself for having started before I knew where I want to end up.</text></item><item><author>lumb63</author><text>Surprising. If only there were a way that we could have foreseen that an AI trained to write code in part by looking at people who, self-admittedly, don’t know how to write code, and people who write code for others with minimal context (Stack Overflow), would produce buggy code. It is a case of GIGO.&lt;p&gt;Most developers do not learn much from Stack Overflow. Why do we expect AI to fare better? In my experience, one in ten (optimistically) Stack Overflow answers give anything more than a code snippet with enough information to get the asker through their immediate issue. It can be beneficial if you have the necessary understanding already and only want the code snippet, but this is no way for humans or machines to learn.&lt;p&gt;Also, having an “AI Assistant” must lower programmers’ guards against buggy code. After all, it is an assistant - it must assist you, right? Subordinating humans to machines will not work in this domain until there is better training data and the machines can be taught the reason they are writing specific code. Until then, I have low hopes for AI-generated code.&lt;p&gt;Even if AI could generate correct, bug-free code the majority (say 99.9% of the time), I expect finding and correcting bugs will be difficult for humans. For example, how many bugs are found and corrected by the author of code during development, versus how many in peer review? I’m reminded of a saying akin to “ask someone to review 5,000 lines of code: no bugs. Ask someone to review 5 lines of code: 5 bugs”. We are poor critical reviewers, and AI cannot fix that. AI assistants probably worsen reviews, because reviewers will expect high-quality code from their AI assistants.</text></item></parent_chain><comment><author>wolfram74</author><text>Your example hinges on at least two things&lt;p&gt;1) How many turns do you take on a particular trip&lt;p&gt;2) How do those wrong turns end up? if it&amp;#x27;s &amp;quot;travel time extended by 30 seconds&amp;quot; or &amp;quot;My car, the car I hit and the side of this building are all in shambles&amp;quot; changes what a 10% failure rate means a lot.</text></comment>