Live data from Hacker News

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

minimaxir.com

321–330 of 461 posts

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

#321
post #264
post #82

Earlier quoted context omitted.

I wish people would understand what a large language model is. There is no thinking. No comprehension. No decisions. Instead, think of your queries as super human friendly SQL. The database? Massive amounts of data boiled down to unique entries with probabilities. This is a simplistic, but accurate way to think of LLMs. So how much code is on the web for a particular problem solve? 10k blog entries, stackoverflow res…

> Instead, think of your queries as super human friendly SQL. I feel that comparison oversells things quite a lot. The user is setting up a text document which resembles a question-and-response exchange, and executing a make-any-document-bigger algorithm. So it's less querying for data and more like shaping a sleeping dream of two fictional characters in conversation, in the hopes that the dream will depict one chara…

[deleted]

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

#322
post #195

Earlier quoted context omitted.

To the downvoters: I am curious if the downvoting is because of my speculation, or because of the difference in understanding of decoder transformer models. Thanks!

Because you cite is about: > in-context learning LLMs have no concept of the symantic meaning of what they do, they just are dealing with next token prediction. "in-context learning" is the problem, not the solution to general programming tasks. Memoryless, ergodic, sub Turing complete problems are a very tiny class. Think about how the Entscheidungsproblem relates to halting or the frame problem and the specificatio…

> they just are dealing with next token prediction.

And nuclear power plants are just heating water.

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

#323
post #261

Earlier quoted context omitted.

TBH I'm not sure how he arrived at "won’t replace software engineers anytime soon" The LLM solved his task. With his "improved prompt" the code is good. The LLM in his setup was not given a chance to actually debug its code. It only took him 5 "improve this code" commands to get to the final optimized result, which means the whole thing was solved (LLM execution time) in under 1 minute.

A non-engineer would not be able to interpret ANY of what he did here, or fix any of the bugs.

A non-engineer by definition would not be able to fix bugs.

But why does it matter that they won't be able to interpret anything? Just like with real engineers you can ask AI to provide an explanation digestible by an eloi.

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

#324

Earlier quoted context omitted.

Did you read the two paragraphs written above and the one where he made that statement? My comments on "what you are not sure" is that Max is a software engineer (I am sure a good one) and he kept iterating the code until it reached close to 100x faster code because he knew what "write better code" looked like. Now ask yourself this question: Is there any chance a no-code/low-code developer will come to a conclusion…

> Max is a software engineer (I am sure a good one) Opinions are mixed.

I'd hear one where somebody thought you failed at software engineering.

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

#325
post #314

Earlier quoted context omitted.

I have been using various LLMs to do some meal planning and recipe creation. I asked for summaries of the recipes and they looked good. I then asked it to link a YouTube video for each recipe and it used the same video 10 times for all of the recipes. No amount of prompting was able to fix it unless I request one video at a time. It would just acknowledge the mistake, apologize and then repeat the same mistake again.…

You're expecting it to be an 'oracle' that you prompt it with any question you can think of, and it answers correctly. I think your experiences will make more sense in the context of thinking of it as a heuristic model based situation simulation engine, as I described above. For example, why would it have URLs to youtube videos of recipes? There is not enough storage in the model for that. The best it can realistical…

> an oxtail soup recipe

Sounds like the model just copy pasted one from the internet, hard to get that wrong. GP could have had a bespoke recipe and list of ingredients. This particular example of yours just reconfirmed what was being said: it's only able to copy-paste existing content, and it's lost otherwise.

In my case I have huge trouble making it create useful TypeScript code for example, simply because apparently there isn't sufficient advanced TS code that is described properly.

For completeness sake, my last prompt was to create a function that could infer one parameter type but not the other. After several prompts and loops, I learned that this is just not possible in TypeScript yet.

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

#326

Earlier quoted context omitted.

TBH I'm not sure how he arrived at "won’t replace software engineers anytime soon" The LLM solved his task. With his "improved prompt" the code is good. The LLM in his setup was not given a chance to actually debug its code. It only took him 5 "improve this code" commands to get to the final optimized result, which means the whole thing was solved (LLM execution time) in under 1 minute.

Did you read the two paragraphs written above and the one where he made that statement? My comments on "what you are not sure" is that Max is a software engineer (I am sure a good one) and he kept iterating the code until it reached close to 100x faster code because he knew what "write better code" looked like. Now ask yourself this question: Is there any chance a no-code/low-code developer will come to a conclusion…

I mean from this sample of 2 you could just ask it repeatedly for up to 5 times restarting the counter whenever performance improves.

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

#327

By iterating it 5 times the author is using ~5x the compute. It’s kinda a strange chain of thought. Also: premature optimization is evil. I like the first iteration most. It’s not “beginner code”, it’s simple. Tell sonnet to optimize it IF benchmarks show it’s a pref problem. But a codebase full of code like this, even when unnecessary, would be a nightmare.

> I like the first iteration most. It’s not “beginner code”, it’s simple.

Yes, thank you. And honestly, I work with a wide range of experience levels, the first solution is what I expect from the most experienced: it readably and precisely solves the stated problem with a minimum of fuss.

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

#329

Earlier quoted context omitted.

In my experience the trouble with LLMs at the professional level is that they're almost as much work to prompt to get the right output as it would be to simply write the code. You have to provide context, ask nicely, come up with and remind it about edge cases, suggest which libraries to use, proofread the output, and correct it when it inevitably screws up anyway. I use Copilot for autocomplete regularly, and that's…

> In my experience the trouble with LLMs at the professional level is that they're almost as work to prompt to get the right output as it would be to simply write the code. Yeah. It's often said that reading (and understanding) code is often harder than writing new code, but with LLMs you always have to read code written by someone else (something else). There is also the adage that you should never write the most cl…

Another adage is "code should be written for people to read, and only incidentally for machines to execute". This goes directly against code being written by machines.

I still use ChatGPT for small self-contained functions (e.g. intersection of line and triangle) but mark the inside of the function clearly as chat gpt made and what the prompt was.

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

#330
post #325
post #314

Earlier quoted context omitted.

You're expecting it to be an 'oracle' that you prompt it with any question you can think of, and it answers correctly. I think your experiences will make more sense in the context of thinking of it as a heuristic model based situation simulation engine, as I described above. For example, why would it have URLs to youtube videos of recipes? There is not enough storage in the model for that. The best it can realistical…

> an oxtail soup recipe Sounds like the model just copy pasted one from the internet, hard to get that wrong. GP could have had a bespoke recipe and list of ingredients. This particular example of yours just reconfirmed what was being said: it's only able to copy-paste existing content, and it's lost otherwise. In my case I have huge trouble making it create useful TypeScript code for example, simply because apparent…

No, that example is not something that I would find very useful or a good example of its abilities- just one thing I generally expected it to be capable of doing. One can quickly confirm that it is doing the work and not copying and pasting the list by altering the recipe to include steps and ingredients not typical for such a recipe. I made a few such alterations just now, and reran it, and it adjusted correctly from a clean prompt.

I've found it able to come up with creative new ideas for solving scientific research problems, by finding similarities between concepts that I would not have thought of. I've also found it useful for suggesting local activities while I'm traveling based on my rather unusual interests that you wouldn't find recommended for travelers anywhere else. I've also found it can solve totally novel classical physics problems with correct qualitative answers that involve keeping track of the locations and interactions of a lot of objects.. I'm not sure how useful that is, but it proves real understanding and modeling - something people repeatedly say LLMs will never be capable of.

I have found that it can write okay code to solve totally novel problems, but not without a ton of iteration- which it can do, but is slower than me just doing it myself, and doesn't code in my style. I have not yet decided to use any code it writes, although it is interesting to test its abilities by presenting it with weird coding problems.

Overall, I would say it's actually not really very useful, but is actually exhibiting (very much alien and non-human like) real intelligence and understanding. It's just not an oracle- which is what people want and would find useful. I think we will find them more useful with having our own better understanding of what they actually are and can do, rather than what we wish they were.

Post reply on HN