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…
Can LLMs write better code if you keep asking them to “write better code”?
391–400 of 461 posts
Re: Can LLMs write better code if you keep asking them to “write better code”?
#392I'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.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#393Earlier 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…
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”?
#394Earlier 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…
Re: Can LLMs write better code if you keep asking them to “write better code”?
#395Re: Can LLMs write better code if you keep asking them to “write better code”?
#396Earlier 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.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#397Earlier 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.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#398Earlier 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…
Re: Can LLMs write better code if you keep asking them to “write better code”?
#399Earlier 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
Re: Can LLMs write better code if you keep asking them to “write better code”?
#400Earlier 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.