1 vote

The coming loop

1 comment

  1. fxgn
    (edited )
    Link
    The developer of Pi keep surprising me with very reasonable takes. I already commented about this one in this thread, so I'll copy my comment: There is one type of cancerous coding pattern all...

    The developer of Pi keep surprising me with very reasonable takes. I already commented about this one in this thread, so I'll copy my comment:


    There is one type of cancerous coding pattern all models make, no matter how good the model is, and no matter how detailed the AGENTS.md. I found it's best described here:

    Present-day models tend to produce code that is too defensive, too complex, too local in its reasoning. They avoid strong invariants. They add fallbacks instead of making bad states impossible.
    [...]
    Furthermore it’s well understood that models tend to observe some local failure and add a local defense. Karpathy mentioned how they are “mortally terrified of exceptions”. In systems with important invariants, especially persisted data formats or core infrastructure, the right fix is not “handle every malformed case.” The right fix is to make the malformed case unrepresentable or impossible to write in the first place. Yet even with a lot of manual steering, that type of code does not come out of LLMs naturally, and even if the code comes out naturally like that, they will still attempt to handle now impossible errors.

    The models would rather add a if (property !== null) check all over the code than just add that to the type definition and handle the null case in the single place it could possibly arise.

    Until this is somehow improved, there is no way I'd ever prompt AI without fixing the generated code. Sometimes the model does a bad job and I have to refactor most of it myself, sometimes it does a good job and I dont. In any case, I don't think I've ever had a situation where I didn't have to first remove a bunch of useless defensive checks from the generated code.

    It seems like the "best" models are even worse in this regard. I've tried GPT-5.5, but I keep going back to DeepSeek v4, because GPT keeps insisting on adding that stuff all over even when I remove it.