Live data from Hacker News

LLMs are mortally terrified of exceptions

twitter.com

121–130 of 157 posts

Re: LLMs are mortally terrified of exceptions

#121
post #46

This is a parody but the phenomenon is real. My uninformed suspicion is that this kind of defensive programming somehow improves performance during RLVR. Perhaps the model sometimes comes up with programs that are buggy enough to emit exceptions, but close enough to correct that they produce the right answer after swallowing the exceptions. So the model learns that swallowing exceptions sometimes improves its reward.…

My suspicion is that the training set features a lot of code with “positive sentiment” in text and comments around it… but where does one find code with “negative” sentiment, followed by code that is the “corrected” version of that code? In programs written for technical interview prep, where handling of edge cases beyond realistic production situations is the norm. A model trained to use negative examples in its training set as guidance would gravitate away from examples that skip exception handling.

In this, at least, AI may very well have copied our worst habits of “learning to the test.”

Re: LLMs are mortally terrified of exceptions

#122
post #96

Earlier quoted context omitted.

If you're an extensive user of ChatGPT, or if you can give it some material about yourself like say, a resume or a LinkedIn profile, ask it to roast you. It will be very specific to the content you give it. Be warned, it can be brutal.

Periodic reminder that there’s also HN Wrapped. [0] [0]: https://hn-wrapped.kadoa.com

>You voted with your feet and moved to Western Europe for better well-being, but you still won't vote with your cursor and use a browser other than Edge.

I love this and hate this at the same time.

Re: LLMs are mortally terrified of exceptions

#124
post #39

That code has many issues, but the one that bothers me the most in practice is this tendency of adding imports inside functions. I can only assume that it's an artifact of them optimizing for a minimal number of edits somewhere in the process, but I expect better.

It's to make imports lazy, to solve the issue of slow import at startup.

I also recently ran into a problem when unit testing and monkey patching where I had to import after monkey patching, so in the function itself.

Re: LLMs are mortally terrified of exceptions

#125
post #46

This is a parody but the phenomenon is real. My uninformed suspicion is that this kind of defensive programming somehow improves performance during RLVR. Perhaps the model sometimes comes up with programs that are buggy enough to emit exceptions, but close enough to correct that they produce the right answer after swallowing the exceptions. So the model learns that swallowing exceptions sometimes improves its reward.…

Defensive programming is considered "correct" by the people doing the reinforcing, and is a huge part of the corpus that LLM's are trained on. For example, most python code doesn't do manual index management, so when it sees manual index management it is much more likely to freak out and hallucinate a bug. It will randomly promote "silent failure" even when a "silent failure" results in things like infinite loops, be…

LLMs do use simple "word prediction" in the pretraining step, just ingesting huge quantities of existing data. But that's not what LLM companies are shipping to end users.

Subsequently, ChatGPT/Claude/Gemini/etc will go through additional training with supervised fine-tuning, reinforcement learning with reward functions whether human-supervised feedback (RLHF) or reward functions (RLVR, 'verified rewards').

Whether that fine-tuning and reward function generation give them real "intelligence" is open to interpretation, but it's not 100% plagarism.

Re: LLMs are mortally terrified of exceptions

#126
My wishlist top item is to stop creating a class with Service on the name and having things come off it, when all I needed was functions and methods, the dev I was working with submitted a lot of these and in testing I could get the LLM to do it easily myself.

Re: LLMs are mortally terrified of exceptions

#127
post #62

That's funny but definitely not far off from reality. I have instructions from my agent to use exceptions but they only help so much. I really dislike their underuse of exceptions. I'm working on ETL/ELT scripts. Just let stuff blow up on me if something is wrong. Like, that config entry "foo" is required. There's no point in using config.get("foo") with a None check which then prints a message and returns False or w…

Aaaand there we go. I literally just ran into a problem with code someone had used AI to write which does this log and continue nonsense. Process spent 30 minutes looping through API requests and failing to persist the response on every single one because of a permission error. But the only indication of a problem is the errors in the log, the process finished with a successful exit code.

Re: LLMs are mortally terrified of exceptions

#128
post #52

Earlier quoted context omitted.

I think there’s always a danger of these foundational model companies doing RLHF on non-expert users, and this feels like a case of that. The AIs in general feel really focused on making the user happy - your example, and another one is how they love adding emojis to the stout and over-commenting simple code.

'over-commenting simple code' is preparing it for future agent work. pay attention to those comments to learn how you can better scaffold for agents.

They should have a step to remove those sorts of comments, they only add noise to the code.

Re: LLMs are mortally terrified of exceptions

#129
post #56

Earlier quoted context omitted.

This is stunning English: "Perfect setup for satire. Here’s a Python function that fully commits to the bit — a traumatically over-trained LLM trying to divide numbers while avoiding any conceivable danger:" "Traumatically over-trained", while scoring zero google hits, is an amazingly good description. How can it intuitively know what "traumatic over-training" should mean for LLMs without ever having been taught the…

> How can it intuitively know what "traumatic over-training" should mean for LLMs without ever having been taught the concept? Because, and this is a hot take, LLMs have emergent intelligence

Or language has patterns

Re: LLMs are mortally terrified of exceptions

#130
post #81

Earlier quoted context omitted.

"Why is a laser beam like goldfish? Because neither one can whistle." - Mike, The Moon is a Harsh Mistress

Fantastic book, just read it. Surprised no movie has been made.

You’d think some filmmaker would have run with the dystopian theme. The accuracy of the book’s predictions is impressive, even the location of the North American Space Defense Command. The biggest miss was people using wired telephones everywhere.
Post reply on HN