Live data from Hacker News

LLMs are mortally terrified of exceptions

twitter.com

81–90 of 157 posts

Re: LLMs are mortally terrified of exceptions

#81
post #55

Earlier quoted context omitted.

This part from the first try made me laugh: if random.random()

I think that’s the funniest joke I’ve ever seen an LLM make. Which probably means it’s copied from somewhere.

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

Re: LLMs are mortally terrified of exceptions

#82
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…

LLMs operate at token level, not word. it doesn't operate in terms of "traumatic", "over-training", "over" or "training", but rather "tr" "aum" "at" "ic, ", etc.

Weird thing I've noticed.

Some LLMs can output nerd font glyphs and others can't.

If I recall grok code fast can but codex and sonnet can't

Re: LLMs are mortally terrified of exceptions

#83
post #75

Earlier quoted context omitted.

This feels like RLVR, not RLHF. With RLVR, the LLM is trained to pursue "verified rewards." On coding tasks, the reward is usually something like the percentage of passing tests. Let's say you have some code that iterates over a set of files and does processing on them. The way a normal dev would write it, an exception in that code would crash the entire program. If you swallow and log the exception, however, you can…

> This is an easy way to get "number of files successfully processed" up, without actually making your code any better. Well, it depends a bit on what your goal is. Sometimes the user wants to eg backup as many files as possible from a failing hard drive, and doesn't want to fail the whole process just because one item is broken.

You're right, but the way to achieve this is to allow the error to propagate at the file level, then catch it one function above and continue to the next one.

However, LLM generated code will often, at least in my experience, avoid raising any errors at all, in any case. This is undesirable, because some errors should result in a complete failure - for example, errors which are not transient or environment related but a bug. And in any case, a LLM will prefer turning these single file errors into warnings, though the way I see it, they are errors. They just don't need to abort the process, but errors nonetheless.

Re: LLMs are mortally terrified of exceptions

#84
post #55

Earlier quoted context omitted.

This part from the first try made me laugh: if random.random()

I think that’s the funniest joke I’ve ever seen an LLM make. Which probably means it’s copied from somewhere.

It would not be shocking if LLMs are legitimately better at making jokes about tasks they are extensively trained on.

Re: LLMs are mortally terrified of exceptions

#86
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, because it was trained on a lot of tutorial python code and "industry standard" gets more reinforcement during training.

These aren't operating on reward functions because there's no internal model to reward. It's word prediction, there's no intelligence.

Re: LLMs are mortally terrified of exceptions

#87

I've noted that LLMs tend to produce defensive code to a fault. Lots of unnecessary checks, e.g. check for null/None/undefined multiple times for same valie. This can lead to really hard to read code, even for the LLM itself. The RL objectives probably heavily penalize exceptions, but don't reward much for code readability or simplicity.

I have a function that compares letters to numbers for the Major System and it's like 40 lines of code and copilot starts trying to add "guard rails" for "future proofing" as if we're adding more numbers or letters in the future.

It's so annoying.

Re: LLMs are mortally terrified of exceptions

#89

Not sure why but it made me think of FizzBuzzEnterpriseEdition https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

Woah, were they using junit 4.8.3 in that project? Someone was flying by the seat of their pants, I hope they got sign-off on that by legal & the CTO, that’s the kind of cowboy coding choice that can hurt a career.

PRs are welcome!

Re: LLMs are mortally terrified of exceptions

#90

Sorry I thought it would be clear and could have clarified that the code itself is just a joke illustrating the point, as an exaggeration. This was the thread if anyone is interested https://chatgpt.com/share/68e82db9-7a28-8007-9a99-bc6f0010d1...

It was a great joke, that's why I posted it
Post reply on HN