4 ms·
> The reason reproducible builds are tricky is not because compilers are inherently prone to randomness And neither are LLMs. Having their output employ random
by mpyne 5mo ago
> The reason reproducible builds are tricky is not because compilers are inherently prone to randomness
And neither are LLMs. Having their output employ randomness by default is a choice, not a requirement, just like things like embedding timestamps into builds is a choice that can be unwound if you want the build to be reproducible.
> People need to stop comparing LLMs to compilers, it's an embarrassingly poor analogy.
They are certainly different things, but if you are going to criticize LLMs it would be better if you understood them.
- deleted 5mo ago[deleted]
- jmuguy 5mo agoAre you arguing that the output of an LLM isn’t random?
- mpyne 5mo agoIt is random if you select it to be (temperature != 0, etc.). It is not random if you don't use random sampling in its output generation. It the whole thing were actually stochastic then prompt caching would be impossible because having a cache of what the previous tokens transformed into to speed up future generation would be invalidated by the missing random state. Look at llama.cpp, you can see what samplers are adjustable and if you use samplers that employ randomness you can see what settings disable the random sampling. Or you can employ randomness but fix the seed to get reproducible results.
- sumeno 5mo agoYes, it can still be random with temperature set to 0. It'll only be the same if you run it on exactly the same hardware every single time.
- philipswood 5mo agoAn LLM is a set of structured matrix multiplies and function applications. The only potentially non-deterministic step is selecting the next token from the final output and that can be done deterministically.
- jmalicki 5mo agoMatrix multiplication on GPUs is non-deterministic. As are things like cumsum() https://docs.pytorch.org/docs/2.11/generated/torch.use_deterministic_algorithms.html#torch.use_deterministic_algorithms https://docs.pytorch.org/docs/2.11/generated/torch.use_deter... This comes down to map reduce and floating point's lack of associativity. You see the same thing with OpenMP on CPUs. People are constantly claiming determinism in LLMs that is just not there.
- vrighter 5mo agowell just run all inference on the cpu, single threaded /s
- zadikian 5mo agoEven if it were reproducible, realistically most people are using some service like Claude that makes no guarantee that the model or hardware didn't change. Which is fine, it doesn't need reproducibility. This is interesting though, I didn't know PyTorch had a debug mode for reproducibility.
- jmalicki 5mo agoEven with this debug mode, a different batch size can give different results for the same input - e.g. your tensor multiplies might use different blocking, hence different associativity. I posted that to show that at a bare minimum, there is some pretty extreme nondeterminism (though probably mild in effect) in even the most pedestrian GPU inference, unless you go to the extreme of using the debug mode and taking the potential performance hit.
- 8note 5mo agorandom isnt the right term. ill conditioned or unstable is better a small change in the input can create a large difference in the output.
- achierius 5mo ago> Having their output employ randomness by default is a choice, not a requirement This is not really meaningfully true. E.g. batching, heterogeneous inference HW, and even differences in model versions can make a difference in what result you get, and these are hard to solve.
- mpyne 5mo agoBut again, these are all things that are also true of build systems. GCC 16.1 vs. 15.2 will get you differences. GNU ld vs. gold vs. mold vs. lld will get you differences. Whether you do or do not employ LTO or other whole-program optimization vs. whether you do gets you differences. Have you never debugged a race condition that worked on your machine but didn't work in prod, based only on how things ended up compiled in the final binary? I'm not saying these are identical but there's a lot more similarity than you all seem to understand. And we've made compilers work well enough that a lot of you believe that they give very routine, very deterministic outputs as part of broader build systems even though nothing could be further from the truth, even today.
- kibwen 5mo ago> And neither are LLMs. This is not my claim, you're veering wildly off course here. I'm merely responding to the common, tiresome and, to be frank, stupid analogy of LLMs to compilers.