Researchers have found that large language models (LLMs) tend to parrot buggy code when tasked with completing flawed snippets.

That is to say, when shown a snippet of shoddy code and asked to fill in the blanks, AI models are just as likely to repeat the mistake as to fix it.

  • taladar@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    102
    ·
    1 day ago

    I don’t see why anyone would expect anything else out of a “what is the most likely way to continue this” algorithm.

    • xthexder@l.sw0.com
      link
      fedilink
      English
      arrow-up
      6
      ·
      17 hours ago

      It doesn’t help that the AI also has no ability to go backwards or edit code, it can only append. The best it can do is write it all out again with changes made, but even then, the chance of it losing the plot while doing that is pretty high.

      • Lemminary@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        14 hours ago

        Yeah, that’s what the canvas feature is for with ChatGPT. And you guessed it, it’s behind a paywall. :)

    • Goun@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      13 hours ago

      This is what I was thinking, if you give the code to a person and ask them to finish it, they would do the same.

      If you rather ask the LLM to give some insights about the code, it might tell you what’s wrong with it.

    • skip0110@lemm.ee
      link
      fedilink
      English
      arrow-up
      33
      ·
      1 day ago

      To be fair, if you give me a shit code base and expect me to add features with no time to fix the existing ones, I will also just add more shit on the pile. Because obviously that’s how you want your codebase to look.

      • sugar_in_your_tea@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        4 hours ago

        And if you do that without saying you want to refactor, I likely won’t stand up for you on the next round of layoffs. If I wanted to make the codebase worse, I’d use AI.

        • skip0110@lemm.ee
          link
          fedilink
          English
          arrow-up
          2
          ·
          5 hours ago

          I’ve been in this scenario and I didn’t wait for layoffs. I left and applied my skills where shit code is not tolerated, and quality is rewarded.

          But in this hypothetical, we got this shit code not by management encouraging the right behavior, and giving time to make it right. They’re going to keep the yes men and fire the “unproductive” ones (and I know fully, adding to the pile is not, in the long run, productive, but what does the management overseeing this mess think?)

          • sugar_in_your_tea@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            3
            ·
            4 hours ago

            Fair.

            That said, we have a lot of awful code at my org, yet we also have time to fix it. Most of the crap came from the “move fast and break things” period, but now we have the room to push back a bit.

            There’s obviously a balance, and as a lead, I’m looking for my devs to push back and make the case for why we need the extra time. If you convince me, I’ll back you up and push for it, and we’ll probably get the go-ahead. I’m not going to approve everything though because we can’t fix everything at once. But if you ignore the problems and trudge along anyway, I’ll be disappointed.