Live data from Hacker News

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

minimaxir.com

391–400 of 461 posts

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

#391
post #137
post #80

I'm amused that neither the LLM or the author identified one of the simplest and most effective optimizations for this code: Test if the number is max _before_ doing the digit sum. It's a free 5.5x speedup that renders some of the other optimizations, like trying to memoize digit sums, unnecessary. On an m1 macbook pro, using numpy to generate the random numbers, using mod/div to do digit sum: Base: 55ms Test before…

There's another, arguably even simpler, optimization that makes me smile. (Because it's silly and arises only from the oddity of the task, and because it's such a huge performance gain.) You're picking 1,000,000 random numbers from 1 to 100,000. That means that any given number is much more likely to appear than not. In particular, it is very likely that the list contains both 3999 (which is the smallest number with…

Ahhhh so we can just return the result without doing anything!

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

#392

I've noticed this with GPT as well -- the first result I get is usually mediocre and incomplete, often incorrect if I'm working on something a little more obscure (eg, OpenSCAD code). I've taken to asking it to "skip the mediocre nonsense and return the good solution on the first try". The next part is a little strange - it arose out of frustration, but it also seems to improve results. Let's call it "negative incent…

I suspect that all it does is prime it to reach for the part of the training set that was sourced from rude people who are less tolerant of beginners and beginners' mistakes – and therefore less likely to commit them.

I don't know if I would say that there's a correlation between being rude/arrogant and competent

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

#393
post #350

Earlier quoted context omitted.

> You seem to be equating "being able to predict the next symbol in a sequence" with "possessing a deep causal understanding of the real-world processes that generated that sequence" More or less, but to be more specific I would say that increasingly accurately predicting the next symbols in a massive set of diverse sequences, which explain a huge diversity of real world events described in sequential order, requires…

> specific I would say that increasingly accurately predicting the next symbols in a massive set of diverse sequences, which explain a huge diversity of real world events described in sequential order, requires increasingly accurate models of the underlying processes of said events But it doesn’t - it’s a statistical model using training data, not a physical or physics model, which you seem to be equating it to (corr…

> But it doesn’t - it’s a statistical model using training data, not a physical or physics model, which you seem to be equating it to (correct me if I am misunderstanding)

All learning and understanding is fundamentally statistical in nature- probability theory is the mathematical formalization of the process of learning from real world information, e.g. reasoning under uncertainty[1].

The model is assembling 'organically' under a stochastic optimization process- and as a result is is largely inscrutable, and not rationally designed- not entirely unlike how biological systems evolve (although also still quite different). The fact that it is statistical and using training data is just a surface level fact about how a computer was setup to allow the model to generate, and tells you absolutely nothing about how it is internally structured to represent the patterns in the data. When your training data contains for example descriptions of physical situations and the resulting outcomes, the model will need to at least develop some type of simple heuristic ability to approximate the physical processes generating those outcomes- and at the limit of increasing accuracy, that is an increasingly sophisticated and accurate representation of the real process. It does not matter if the input is text or images any more than it matters to a human that understands physics if they are speaking or writing about it- the internal model that lets it accurately predict the underlying processes leading to specific text describing those events is what I am talking about here, and deep learning easily abstracts away the mundane I/O.

An LLM is an alien intelligence because of the type of structures it generates for modeling reality are radically different from those in human brains, and the way it solves problems and reasons is radically different- as is quite apparent when you pose it a series of novel problems and see what kind of solutions it comes up with. The fact that it is trained on data provided by humans doesn't change the fact that it is not itself anything like a human brain. As such it will always have different strengths, weaknesses, and abilities from humans- and the ability to interact with a non-human intelligence to get a radically non-human perspective for creative problem solving is IMO, the biggest opportunity they present. This is something they are already very good at, as opposed to being used as an 'oracle' for answering questions about known facts, which is what people want to use it for, but they are quite poor at.

[1] Probability Theory: The Logic of Science by E.T. Jaynes

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

#394
post #245

Earlier quoted context omitted.

I agree. However, my point is that they have to compress information in nontrivial ways to achieve their goal. The typical training set of modern LLMs is about 20 trillion tokens of 3 bytes each. There is definitely some redundancy, and typically the 3rd byte is not fully used, so probably 19 bits would suffice; however, in order to fit that information into about 100 billion parameters of 2 bytes each, the model nee…

It's hard to know where to start ... A transformer is not a compressor. It's a transformer/generator. It'll generate a different output for an infinite number of different inputs. Does that mean it's got an infinite storage capacity? The trained parameters of a transformer are not a compressed version of the training set, or of the information content of the training set; they are a configuration of the transformer s…

I should have emphasized the words "nontrivial ways" in my previous response to you. I didn't mean to emphasize compression and definitely not memorization, just the ability to also learn algorithms that can be evaluated by the parallel decoder-transformer language (RASP-L). Other people had mentioned memorization or clustering/near neighbor algorithms as the main ways that decoder transformers works, and I pointed out a paper that cannot be explained in that particular way no matter how much one would try. That particular paper is not unique, and nobody has shown that decoder transformers can memorize their training sets, because they typically cannot, just because it is a numbers/compression game that is not in their favor and because typical training sets have strong correlations or hidden algorithmic structures that allow for better ways of learning. In the particular example, the training set was random data on different random functions and totally unrelated to the validation / test sets, so compressing the training set would be close to useless anyways and the only way for the decoder transformer to learn was to figure out an algorithm that optimally approximates the function evaluations.

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

#395
post #318

Earlier quoted context omitted.

Doesn’t this line of thinking constantly redefine success until all software is only bugs?

Ah, so that’s what’s been happening!

My personal theory is that the rapture actually already happened but we didn’t notice because only QA was without sin.

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

#396

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.

Then stop stirring the opinion pot, or should I say Max is a software developer and that means you.

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

#397
post #261

Earlier quoted context omitted.

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.

A patient cannot become a doctor by asking AI to explain and prescribe treatment based on symptoms. That's what Simon is trying to say.

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

#398
post #372

Earlier quoted context omitted.

This exactly highlights my fear of widespread use of LLMs for code - missing the actual optimisations because we’re stuck in a review, rather than create, mode of thinking. But maybe that’s a good thing for those of us not dependent on LLMs :)

Well if you or anyone else that has good optimization and performance chops http://openlibrary.org/ has been struggling with performance a bit lately and it's hard to track down the cause. CPU load is low and nothing too much has changed lately so it's unlikely to be a bad query or something. Main thing I've suggested is upgrading the DB from Postgres 9, which isn't an easy task but like 15 years of DB improvements p…

Is there source code / a GitHub link with more information?

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

#399
post #205

Earlier quoted context omitted.

Whose digits sum up to 30, or the sum of whose digits equal 30? Btw, _whose_ digits are we talking about? — I just built a random program generator. After I finish optimizing, I'm gonna test it to see if works! — "If builders built houses the way programmers build programs, the first woodpecker to come along would destroy civilization" https://en.m.wikiquote.org/wiki/Gerald_Weinberg

> Btw, _whose_ digits are we talking about? You seem to be under the impression that whose is not a form of which , which is incorrect. whose:which::whose:who

The sum of the digits of which equals 30.

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

#400

Earlier quoted context omitted.

Why limit its ability to write separate code?

Because otherwise we are talking about LLMs augmented with external tools (i.e. Python interpreters). My original comment was pointing to the limitations of LLMs in writing code by themselves.

But programmers are LLMs augmented with the ability to run code. It seems odd to add a restriction when testing if an LLM is "as good as" a programmer, because if the LLM knows what it would need to do with the external code, that's just as good.
Post reply on HN