upvote
For greenfield projects LLMs don't need abstractions, but as the project gets more complex, the right abstractions save a pot on input tokens (less code to read) and reasoning tokens (less work to do to figure out the code), so they free the context window for higher purposes

Also I suspect that, apart from that, the results on smaller, cleaner codebases are better. LLMs degrade when following more than N instructions (where N depends on the model) even if the context window is not full yet; I suspect they also degrade when code has too many unnecessary concepts and details

reply
I've been working on generating a large code base for the last couple of weeks. Finally got around to generating a sort of code-duplication report and have spent the last week just having it de-duplicating logic that had been strewn all over the place (eg 11 different functions all doing date math to add x days to a date). dozens of items that had each been similar functions duplicated numerous times. crazy. (opus-5-utracode)
reply
LLMs love duplicating logic. Unfortunately they are not formal systems so we actually have to read their output
reply
Can LLMs not do this for you? Or would they go too far?
reply
No, the problem is they're still really dumb, and lack the ability to make logical connections that are obvious to us. "should I walk or drive to the carwash" being a very recent example of the larger problem.
reply
But they are very good at identifying patterns though. This task requires little logic IMO. So why not leverage LLM to perform redundancy analysis?
reply
They add and add new code to the point when adding more is going to become very messy and then spagetti
reply
What I was suggesting is to ask the LLM to compare function usage across files to identify overlap/redundancy.

The idea is to use the LLM to analyse the code base first before taking any action.

I think I'm suggesting a centaur approach.

reply
This is the exact opposite of what I’ve been dealing with for awhile. LLMs absolute cannot work on something without an understanding unless they can outsource the understanding to a verifier. If you’ve got an easy to check function to measure progress then “keep going” is all the prompt you need. But if you need it to figure out “I pushed the up button and it moved up and left” then it’ll find the same bug five ways without realizing it’s just one bug in the underlying math.
reply
LLMs use abstractions a ton in code though: standard library functions, popular libraries, etc. They just dont always make their own abstractions. At least not particularly good ones. LLMs work really well when they have well abstracted pieces to put together.
reply
With good source code they output good code that mimics existing code.

If they don't have good code to mimic, anything goes. They might use libraries or they might start to write their own implementation of a PNG encoder.

reply