Comment by doginasuit
15 hours ago
I have that issue too. One thing I suspect they are amazing at is documentation generation, maybe a good solution is to have it generate a concise summary of helper functions that are available for any given context. Then have it use the same doc when you call in some code generation.
You touched on another baked-in limitation of LLMs: their inability to follow Don't Repeat Yourself. To anthropomorphize a little, LLMs love to repeat themselves. I remember in the early days before reasoning algorithms came along, you could ask an LLM a question and it would often explain the same answer two or three times in a slightly different way. You also see this in image generation with multiple people, they will often do essentially the same person several times with minimal variation. Applied to code, in your functions they saw an earlier pattern and they can't help but write it the same way.
This isn't entirely at odds with producing good code, I often force myself to wait for another occurrence of where a helper function is needed before I write it, lest I create a slew of utilities that are easy to forget about. Maybe it just needs an additional pass: "analyze your output and create a set of helper functions where logic is repeated or the abstraction is wanted."
No comments yet
Contribute on Hacker News ↗