LLM Doesn't Write Correct Code. It Writes Plausible Code

(twitter.com)

60 points | by pretext 7 hours ago ago

73 comments

  • baal80spam 6 hours ago
    • dang 5 hours ago

      Thanks! I'll merge the threads when I'm not on my phone.

  • treetalker 6 hours ago

    This is my experience with how LLMs "draft" legal arguments: at first glance, it's plausible — but may be, and often is, invalid, unsound, and/or ill-advised.

    The catch is that many judges lack the time, energy, or willingness to not only read the documents in detail, but also roll up their sleeves and dig into the arguments and cited authorities. (Some lack the skills, but those are extreme cases.) So the plausible argument (improperly and unfortunately) carries the day.

    LLM use in litigation drafting is thus akin to insurgent/guerilla warfare: it take little time, energy, or thinking to create, yet orders of magnitude more to analyze and refute. (It's a species of Brandolini's Law / The Bullshit Asymmetry Principle.) Thus justice suffers.

    I imagine that this is analogous to the cognitive, technical, and "sub-optimal code" debt that LLM-produced code is generating and foisting upon future developers who will have to unravel it.

    • deaux 6 hours ago

      > This is my experience with how LLMs "draft" legal arguments: at first glance, it's plausible — but may be, and often is, invalid, unsound, and/or ill-advised.

      Correct, and this of course extends past just laws, into the whole scope of rules and regulations described in human languages. It will by its nature imply things that aren't explicitly stated nor can be derived with certainty, just because they're very plausible. And those implications can be wrong.

      Now I've had decent success with having LLMs then review these LLM-generated texts to flag such occurences where things aren't directly supported by the source material. But human review is still necessary.

      The cases I've been dealing with are also based on relatively small sets of regulations compared the scope of the law involved with many legal cases. So I imagine that in the domain you're working on, much more needs flagging.

    • roarcher 5 hours ago

      > LLM use in litigation drafting is thus akin to insurgent/guerilla warfare: it take little time, energy, or thinking to create, yet orders of magnitude more to analyze and refute.

      The same goes for coding. I have coworkers who use it to generate entire PRs. They can crank out two thousand lines of code that includes tests "proving" that it works, but may or may not actually be nonsense, in minutes. And then some poor bastard like me has to spend half a day reviewing it.

      When code is written by a human that I know and trust, I can assume that they at least made reasonable, if not always correct, decisions. I can't assume that with AI, so I have to scrutinize every single line. And when it inevitably turns out that the AI has come up with some ass-backwards architecture, the burden is on me to understand it and explain why it's wrong and how to fix it to the "developer" who hasn't bothered to even read his own PR.

      I'm seriously considering proposing that if you use AI to generate a PR at my company, the story points get credited to the reviewer.

      • patrakov 4 hours ago

        Evil voice: "I don't mind not getting credits for the story points. The story was AI-generated anyway."

    • basch 5 hours ago

      "Reasoning" needs to go back to the drawing board.

      Reasonable tasks need to be converted into formal logic, calculated and computed like a standard evaluation, and then translated back into english or language of choice.

      LLMs are being used to think when really they should be the interpret and render steps with something more deterministic in the middle.

      Translate -> Reason -> Store to Database. Rinse Repeat. Now the context can call from the database of facts.

    • FpUser 6 hours ago

      >" justice suffers"

      Possible. It also suffers when majority simply can not afford proper representation

    • 5 hours ago
      [deleted]
  • seanmcdirmid 6 hours ago

    Ok, I’ll bite: how is that different from humans?

    • strken 6 hours ago

      Human behaviour is goal-directed because humans have executive function. When you turn off executive function by going to sleep, your brain will spit out dreams. Dream logic is famous for being plausible but unhinged.

      I have the feeling that LLMs are effectively running on dream logic, and everything we've done to make them reason properly is insufficient to bring them up to human level.

      • seanmcdirmid 5 hours ago

        Isn’t a modern LLM with thinking tokens fairly goal directed? But yes, we hallucinate in our sleep while LLMs will hallucinate details if the prompt isn’t grounded enough.

        • zarzavat 5 hours ago

          The thing about dream logic is that it can be a completely rational series of steps, but there's usually a giant plot hole which you only realise the second you wake up.

          This definitely matches my experience of talking to AI agents and chatbots. They can be extremely knowledgeable on arcane matters yet need to have obvious (to humans) assumptions pointed out to them, since they only have book smarts and not street smarts.

        • tovej 5 hours ago

          Assuming this is not a rhetorical question: no, it is not. The only "goal" is to maximize plausibility.

          • seanmcdirmid 5 hours ago

            Again, how is that different from humans? I’m not going around trying to prove my code correct when I write it manually.

      • satvikpendem 6 hours ago

        A prompt for an LLM is also a goal direction and it'll produce code towards that goal. In the end, it's the human directing it, and the AI is a tool whose code needs review, same as it always has been.

        • basch 5 hours ago

          Id argue humans have some sort of parallelness going on that machines dont yet. Thoughts happening at multiple abstraction levels simultaneously. As I am doing something, I am also running the continuous improvement cycle in my head, at all four steps concurrently. Is this working, is this the right direction, does this validate?

          You could build layers and layers of LLMs watching the output of each others thoughts and offering different commentary as they go, folding all the thoughts back together at the end. Currently, a group of agents acts more like a discussion than something somewhat omnipotent or omnitemporal.

      • whoamii 6 hours ago

        Some of my best code comes from my dreams though.

      • tsunamifury 6 hours ago

        It’s amazing how much you get wrong here. As LLM attention layers are stacked goal functions.

        What they lack is multi turn long walk goal functions — which is being solved to some degree by agents.

      • nemo44x 6 hours ago

        LLMs are literally goal machines. It’s all they do. So it’s important that you input specific goals for them to work towards. It’s also why logically you want to break the problem into many small problems with concrete goals.

        • andai 5 hours ago

          Do you only mean instruct-tuned LLMs? Or the base (pretrained) model too?

          • nemo44x 4 hours ago

            The entire system and the agent loop allows for more complex goal resolution. The LLM models language (obviously) and language is goal oriented so it models goal oriented language. It’s an emergent feature of the system.

      • spiderfarmer 6 hours ago

        And yet LLM’s are incredibly useful as they are right now.

    • detourdog 5 hours ago

      What I'm surprises me about the current development environment is the acceleration of technical debt. When I was developing my skills the nagging feeling that I didn't quite understand the technology was a big dark cloud. I felt this clopud was technical debt. This was always what I was working against.

      I see current expectations that technical debt doesn't matter. The current tools embrace superficial understand. These tools to paper over the debt. There is no need for deeper understanding of the problem or solution. The tools take care of it behind the scenes.

    • wood_spirit 6 hours ago

      It’s not. LLMs are just averaging their internet snapshot, after all.

      But people want an AI that is objective and right. HN is where people who know the distinction hang out, but it’s not what the layperson things they are getting when they use this miraculous super hyped tool that everybody is raving about?

      • mrwh 5 hours ago

        The etiquette, even at the bigtech place I work, has changed so quickly. The idea that it would be _embarrassing_ to send a code review with obvious or even subtle errors is disappearing. More work is being put on the reviewer. Which might even be fine if we made the further change that _credit goes to the reviewer_. But if anything we're heading in the opposite direction, lines of code pumped out as the criterion of success. It's like a car company that touts how _much_ gas its cars use, not how little.

        • wood_spirit 5 hours ago

          Review is usually delegated to an AI too

      • satvikpendem 6 hours ago

        By now, a few years after ChatGPT released, I don't think anyone is thinking AI is objective and right, all users have seen at least one instance of hallucination and simply being wrong.

        • wood_spirit 6 hours ago

          Sorry I can think of so many counter examples. I also detect a lot of “well it hallucinates about subject X (that the person knows well, so can spot the hallucination)” but continue to trust it on subjects Y and Z (which the person knows less well so can’t spot the hallucinations).

          YMMV.

          • andai 5 hours ago

            > Briefly stated, the Gell-Mann Amnesia effect works as follows. You open the newspaper to an article on some subject you know well. In Murray's case, physics. In mine, show business. You read the article and see the journalist has absolutely no understanding of either the facts or the issues. Often, the article is so wrong it actually presents the story backward-reversing cause and effect. I call these the "wet streets cause rain" stories. Paper's full of them. In any case, you read with exasperation or amusement the multiple errors in a story-and then turn the page to national or international affairs, and read with renewed interest as if the rest of the newspaper was somehow more accurate about far-off Palestine than it was about the story you just read. You turn the page, and forget what you know.

            -Michael Crichton

          • satvikpendem 5 hours ago

            Sure, Gell-Mann amnesia exists, but remember that its origin is actually human, in the form of newspaper writers. So, how can we trust humans the same way? In just the same way, AI cannot also be fully trusted.

            • wood_spirit 5 hours ago

              The current way of doing AI cannot be trusted.

              that doesn’t mean the future won’t herald a way of using what a transformer is good at - interfacing with humans - to translate to and interact with something that can be a lot more sound and objective.

              • satvikpendem 5 hours ago

                You're falling into the extrapolation fallacy, there is no reason to think that the future won't have the same issues as today in terms of hallucinations.

                And even if they were solved, how would that even work? The world is not sound and objective.

                • wood_spirit 4 hours ago

                  It’s a thought experiment. I am not saying I believe it will happen.

                  But right now there are lots of domains where current lauded success is in treating something objective - like code - as tokens for an llm.

                  We could instead explore using transformers to translate human languages to a symbology that can be reasoned about and applied eg to code.

                  It’s the talk of conferences. But whether it works better than we have today, or whether it aligns with the incentives or the big players, is another matter

      • seanmcdirmid 5 hours ago

        There are a lot of binary thinkers on HN, but they shouldn’t make up a majority.

    • rDr4g0n 6 hours ago

      It's much easier to fire an employee which produces low quality/effort work than to convince leadership to fire Claude.

      • satvikpendem 5 hours ago

        You can fire employees who don't review code generated though, because ultimately it's their responsibility to own their code, whether they hand wrote it or an LLM did.

        It seems to me that it's all a matter of company culture, as it has always been, not AI. Those that tolerate bad code will continue to tolerate it, at their peril.

    • apical_dendrite 6 hours ago

      The volume is different. Someone submitted a PR this week that was 3800 lines of shell script. Most of it was crap and none of it should have been in shell script. He's submitting PRs with thousands of lines of code every day. He has no idea how any of it actually works, and it completely overwhelms my ability to review.

      Sure, he could have submitted a ill-considered 3800 line PR five years ago, but it would have taken him at least a week and there probably would have been opportunities to submit smaller chunks along the way or discuss the approach.

      • switchbak 5 hours ago

        It’s harder when the person doing what you describe has the ability to have you fired. Power asymmetry + irresponsible AI use + no accountability = a recipe for a code base going right to hell in a few months.

        I think we’re going to see a lot of the systems we depend on fail a lot more often. You’d often see an ATM or flight staus screen have a BSOD - I think we’re going to see that kind of thing everywhere soon.

      • satvikpendem 6 hours ago

        Just block that user, that seems to be the way.

    • somewhereoutth 6 hours ago

      Humans have a 'world model' beyond the syntax - for code, an idea of what the code should do and how it does it. Of course, some humans are better than others at this, they are recognized as good programmers.

      • satvikpendem 6 hours ago

        Papers show that AI also has a world model, so I don't think that's the right distinction.

        • tovej 5 hours ago

          Could you please cite these papers. If by AI you mean LLMs, that is not supported by what I know. If you mean a theoretical world-model-based AI, that's just a tautological statement.

          • satvikpendem 5 hours ago
            • salawat 4 hours ago

              Their world model is completely a byproduct of language though, not experience. Furthermore, they by deliberate design do not maintain any form of self-recognition or narrative tracking, which is the necessary substrate for developing validating experience. The world model of an LLM is still a map. Not the territory. Even though ours has some of the same qualities arguably, the identity we carry with us and our self-narrative are incredibly powerful in terms of allowing us to maintain alignment with the world as she is without munging it up quite as badly as LLM's seem prone to.

              • satvikpendem 4 hours ago

                How do you know ours is any different, that we are not in a simulation or a solipsistic scenario? The truth is that one cannot know, it's a philosophical quandary that's been debated for millennia.

                • topaz0 4 hours ago

                  It is absolutely obvious how different it is from interacting with any LLM about the ways that it is wrong.

                  • satvikpendem 2 hours ago

                    Nope, appeal to obviousness is not a sound argument. There are many things people thought were obvious that were wrong.

                    • topaz0 2 hours ago

                      It wasn't an argument. There isn't much point in going to a lot of trouble to make an argument to someone so clearly determined to ignore the truth. It is nevertheless true.

                      • satvikpendem 2 hours ago

                        Just saying something is true doesn't make it so. Truth requires justification, and if you can't provide that, then there's no reason to believe it's true. For someone making a claim, the onus is on them to provide evidence.

                        Otherwise I'll just say I'm right and you're wrong, after all, that's what you're saying.

  • siliconc0w 5 hours ago

    Just a recent anecdote, I asked the newest Codex to create a UI element that would persist its value on change. I'm using Datastar and have the manual saved on-disk and linked from the AGENTS.md. It's a simple html element with an annotation, a new backend route, and updating a data model. And there are even examples of this elsewhere in the page/app.

    I've asked it to do why harder things so I thought it'd easily one-shot this but for some reason it absolutely ate it on this task. I tried to re-prompt it several times but it kept digging a hole for itself, adding more and more in-line javascript and backend code (and not even cleaning up the old code).

    It's hard to appreciate how unintuitive the failure modes are. It can do things probably only a handful of specialists can do but it can also critical fail on what is a straightforward junior programming task.

    • 5 hours ago
      [deleted]
  • andai 6 hours ago

    It writes statistically represented code, which is why (unless instructed otherwise) everything defaults to enterprisey, OOP, "I installed 10 trendy dependencies, please hire me" type code.

  • bitwize 6 hours ago

    You: Claude, do you know how to program?

    Claude: No, but if you hum a few bars I can fake it!

    Except "faking it" turns out to be good enough, especially if you can fake it at speed and get feedback as to whether it works. You can then just hillclimb your way to an acceptable solution.

    • andai 5 hours ago

      Iterative Faking™ — now with plausible-looking test suite!

  • jswelker 5 hours ago

    I also write plausible code. Not much of a moat.

  • seba_dos1 5 hours ago

    s/code/stuff/

  • maremmano 5 hours ago

    this won't age well.

  • shablulman 6 hours ago

    [dead]

  • satvikpendem 6 hours ago

    Oftentimes, plausible code is good enough, hence why people keep using AI to generate code. This is a distinction without a difference.

    • andai 5 hours ago

      There appears to be a similar approach in UX... plausible user experience is close enough.

      • satvikpendem 5 hours ago

        Yes, especially because in UX there is no "correct" approach to it, it's all relative.

    • topaz0 4 hours ago

      2 seconds to insert 100 rows in an empty database table is not "good enough" if you are doing anything that is worth doing.

      • satvikpendem 38 minutes ago

        Who said anything about this? I never did.

    • bluetomcat 5 hours ago

      No. Plausible code is syntactically-correct BS disguised as a solution, hiding a countless amount of weird semantic behaviours, invariants and edge cases. It doesn't reflect a natural and common-sense thought process that a human may follow. It's a jumble of badly-joined patterns with no integral sense of how they fit together in the larger conceptual picture.

      • satvikpendem 5 hours ago

        Why do people keep insisting that LLMs don't follow a chain of reasoning process? Using the latest LLMs you can see exactly what they "think" and see the resultant output. Plausible code does not mean random code as you seem to imply, it means...code that could work for this particular situation.

        • tovej 5 hours ago

          Because they don't. The chain-of-reasoning feature is really just a way to get the LLM to prompt more.

          The fact that it generates these "thinking" steps does not mean it is using them for reasoning. It's most useful effect is making it seem to a human that there is a reasoning process.

          • andai 4 hours ago

            Is this position axiomatic or falsifiable? What would it take to change your mind?

          • seba_dos1 5 hours ago

            I love how generating strings like "let me check my notes" is effective at ending up with somewhat better end results - it pushes the weights towards outputting text that appears to be written by someone who did check their notes :D

            • andai 4 hours ago

              I can't remember which lecture it was, but a guy said "they don't think, they only seem to think, and they won't replace a substantial portion of human labor, they will only seem to do so" ;)

              • seba_dos1 4 hours ago

                Joking aside, this is exactly what happens with companies announcing "AI" replacing human labor when what they actually do is correcting for COVID-time overhiring while trying to make it appear in a way that won't make the stocks go too red.

          • satvikpendem 5 hours ago

            How would you determine humans have reasoning then, in a way that LLMs do not?

            • andai 4 hours ago

              Or — here's a fun one — subjective experience.