Can LLMs write better code if you keep asking them to “write better code”?

In November 2023, a meme trend briefly emerged where users asked ChatGPT to make various images more ‘X,’ resulting in unexpectedly cosmic transformations. This led to pondering whether similar techniques could be applied to code for productivity gains. Despite initial reluctance towards AI code copilots, Claude 3.5 Sonnet proved impressive with prompt adherence and coding benchmarks. An experiment was conducted to optimize Python code using iterative prompting with Claude, resulting in algorithmic improvements and significant speedups. However, further iterations showcased diminishing returns and overengineering the code to ‘enterprise-level’ features. Prompt engineering LLMs like Claude led to even more optimized code results by explicitly defining rules and examples for code optimization. Overall, while cold and ‘robotic’ prompts may yield better LLM performance, it’s crucial in enhancing outputs.

https://minimaxir.com/2025/01/write-better-code/

To top