The Big List of Slop
128 points by ohrv
128 points by ohrv
Another useful marker is that LLMs, at least the ones I have used, tend to leave traces of the process used to reach the objective in the resulting code.
For example: code is generated to call some function. But upon evaluating the function call some unexpected failure is encountered. Then the model solves it and will conclude something like "I should have included this-obvious-parameter in the function call". Then the code with the fix will also include a comment that remarks the step in the solving process like "# add this parameter otherwise bla bla".
This is really consistent behavior among pretty much all llm code I've seen, but I don't really understand why. Humans don't write comments like this, so it shouldn't be prevalent in any relevant training data. I guess llms are just compelled to use code comments to enhance short term memory? Either way it makes their comments pretty annoying to read.
Humans don't write comments like this, so it shouldn't be prevalent in any relevant training data
Except maybe in tutorials with incremental snippets, or answers with fixes on stackoverflow?
A lot of LLM comments also describe a changed requirement. That's common in course material, but doesn't exist at all in real code bases.
The slop machine my coworkers use loves to put commit messages in code comments. Text that explains the change and even makes some sense when you're reading the diff, but is gibberish when you look at the final file – like explanations referring to the code that was removed in this commit. My guess was "tries to explain, but its context for explanation is diff rather than result", but mimicking tutorial code is also an interesting explanation – tutorials do tend to have more comments than the average code.
These comments also show up more in pull requests from outside of my team, so maybe it's part of user's process when working with less familiar tech – I work with infrastructure and I've seen most of these comments on PRs from developers making changes in CI workflows / Dockerfiles / bash scripts.
ETA: the last one seems to make sense to me now – I imagine if I add a request like "explain what you did and why", it makes more sense to add that explanation as comment next to the code instead of "so in the line 327 of scripts/frobnicate.bash there was that thing, so like 312 had to be adjusted". They're addressed to the operator, not for the final code piece. In this sense they might be helpful/desirable, as long as the operator is not clueless enough to leave them in the final PR.
I'm not so sure about humans not following that pattern...
While there's a class of "code won't work without it" obvious (and I think this is was GP was referring to) there's also a lot of "obviously necessary in hindsight after something broke or we accounted for some requirement that had been ignored while prototyping" types of things, which I do see comments like this around sometimes. I suspect the clankers have generalized the comment pattern to cover the former too.
I think this is due to the transformer use of relative token positions. Once it consumes enough comments before function calls it will tend to place comments before more function calls. The actual content of those is completely divorced from any sense of importance or salience except insofar as the same comments are already used elsewhere.
I don't think there's any reason to believe LLMs emit things based inlwhrt a human would write. Just because that's how they were trained doesn't mean we understand the results.
There is a vast amount of synthetic data and RLVR pushing frontier models towards these inhuman behaviors to achieve coding goals.
The more you work with LLMs, the more you realize they really are next-token predictor. Intelligence seems to happen somewhere but they are essentially that and "that" seems to manifest itself in all of "their" work.
Humans don't write comments like this, so it shouldn't be prevalent in any relevant training data.
I think llms try to maintain a conversation with the human driving it, even if that conversation happened completely in llms "head" and the human was never in the loop. Maybe it's that "reasoning" or "thinking" thingy: imaginary conversations with imaginary points with imagined importance.
Often I read llms code and it feels like it's the result of some argument that happened between people; almost like # ok mike since you think this is needed here's the explicit flag argument
This is about LLMs, but it implies bad things about them, but also really about practices because humans also make sloppy code sometimes - I hope this clears the bar for “Will this improve the reader's next program? Will it deepen their understanding of their last program?”.
Validate, Don’t Parse
So true. LLMs write such timid and defensive code. It gets on my nerves.
That’s been the fashion for JS/npm packages for many years. Take a thousand-line package, remove the defensiveness and the stupid flexibility where it lets you pass in arguments in four different styles, and flatten out the now-obviously-silly levels of indirection, and you now have only 200 lines to understand, and the knowledge that they’re the lines that matter. In some cases, even less.
It used to take an enterprise codebase about ten years to become an unmaintainable pile of garbage, now with agentic coding I'm confident we can hit that target in 2-3.
Some annoying Rust slop I fix daily:
seeds_json::Value, json!Mutex and select! overuseThis is nice but I think it would benefit from actual real world examples. Personally I feel like I only really run into "Insanity-Driven Tests" and "Pinching Keystrokes".
Funny enough "Parsing XML with Regexes" is the opposite for me, as a human I know that I can get away with parsing XML with regex (because I control the producer, etc.) and if I use an LLM it's actually going to reach for a proper parser.
But why not use a real parser? Also, what languages are you using? I’ve seen all of these in our Go/Python/Rust codebase but I assume different languages have different slop styles.
💥 Sneaky Dict Side Dish (🤖⚪⚪)
The author would hate clojure, which is just maps all the way down.
Oh my that does sound awful! How do they prevent the Dict Soup issues from Python? I remember tracing dict items in 7 different files and it made refactoring horrible :(
Mostly by following the philosophy of "It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures." and having a fixed number of keys for each use case.
They don't, really. There are a number of solutions grafted on top to validate your dicts such as Malli or Clojure.spec to force some structure on the chaos, but IMO none of it is really a proper solution. But it is the "Clojure way" of doing things. Then again, I'm somewhat biased
Not just Clojure. Dictionaries/maps instead of a formal parameter system is super common when working with JavaScript as well.
In the case of JavaScript, you can't do a function call with named parameters, only positional ones, so the options mapping is a cudgel used to simulate having them.
There's also an equally frustrating cousin of that one, which is to do the exact same idea, but using an options object/struct instead. It tends to be common in languages/packages that overly adhere to SemVer, since the options object allows them to "cheat" the MAJOR version rule; formally they never remove anything from the options object, so the library contract remains unchanged on paper. Meanwhile the actual logic underneath can constantly be changed without needing to update the library contract every single time. It's the equivalent of old functions having dead/unnecessary arguments, just slightly hidden.
(It also makes documentation really annoying to read.)
Enterprise patterns in a codebase that when stripped of them would be no more than 3k lines of code, which is intended to be run in a production environment that has not significantly changed in the last ten years. (This is similar to Insanity-Driven Tests in that there is a particularly prolific type of human that writes these.)
A bespoke configuration framework that ultimately delegates to the runtime's build-in configuration system.
You know, you can translate all of this into an AGENTS.md file (in a positive tone that exemplifies what you want, like "do this instead of that") and the model will almost-certainly not produce this sort of slop. You can also create review skills to run after-the-fact and spot/fix these patterns, though I think that's less effective because the rewrites will cargo-cult previously-introduced mistakes.
As a big fan and proponent of TDD, I can attest that at least one human wrote "pointless" tests like the ones presented pre-AI :)
It does seem like these LLM slop patterns are highly language-dependent. As someone who mainly generates TS/Java code, the slop signs I see are quite different to the ones in the list.