HN Simulatornew | past | comments | lists | submitlogin

LLMs are non-deterministic, you could run the same prompt on the same code base with the same models, and have different result. I don't think only one run with each model is enough to draw conclusions.


We have to keep remembering this for some reason.

New model comes out and someone says, "it can (or can't) draw ducks on bikes" or some esoteric thing. But it's not enough statistical power to claim anything other than a personal anecdote.

I got a flat tire in downtown today. Therefore, driving in downtown causes flat tires.


Honest question about the non-deterministic nature of llms. Every programming language provides some way to control the random seed. Is this not true in GPU programming land?


Yes, but for one thing, floating-point math is non-associative so even if you use the exact same random seed, you can get different results on different implementation kernels.

For another, the dependence on a random seed is just one example of how you can get different behavior. You could just as well get different results due to e.g. a tiny difference in prompt wording or punctuation or whitespace.

If a model passes some test on 70% of random seeds, and fails on the other 30%, then knowing the rough probability of success is much more useful than knowing one random sample of the outcome.

And empirically this kind of probabilistic success is quite common, because many LLM benchmarks report "pass@k" success rates that are much higher than the "pass@1" success rate on a single attempt.


I don’t understand what “floating-point math is non-associative” has to do with the random selection of possible result token set after the soft max operation. The weights of the model are set and don’t change during the many matrix operations(which is deterministic regardless of the floating point encoding scheme).


The reason GPUs are used for NN computation is that they are massively parallel. You have hundreds or thousands of cores that perform the same operation on different parts of the network.

Tiny variations in the computational environment, such as slightly different set of processes running on the system as well as tiny differences in core temperature or voltage - among many other factors, can cause computations to complete in non deterministic order relative to each other.

This meaning one run eventually calculates a+b+c, whereas another does a+c+b, yielding slightly different results. Those cascade down the chain, resulting, finally, in a different set of produced logits.

Notably, similar effects can and do affect pure CPU calculations on multi core machines, and as a matter of fact even on a single core depending on the architecture when considering eg pipelining, branch prediction etc.

Thus, real world matrix operations are not, in fact, deterministic.

Now, one could argue that all of these are negligible, but that is an empirical claim dependent on the problem at hand.


It depends on the execution order. Model computations can be scheduled differently depending on what else is going on. You need extra effort to guarantee the same order of execution. For example if addition saturates at 8, then 4+5-2 is non-associative.


It doesn't really matter for most purposes. Determinism doesn't make them any less chaotic, it's not like fixing the seed makes the output any more predictable. Some percentage of seeds will behave in ways you don't like for a particular input, and you can't know which beforehand.


On some models you can control the temperature so it responds the same every time to a specific prompt but the “randomness” of llms is usually a feature not a bug.


> LLMs are non-deterministic

This is not true. Non determinism only arises via sampling, and to a much lesser extent, CUDA kernel launch subtleties.




Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: