-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Different outputs for differents numbers of threads (same seed) #95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
That isn't surprising, as each thread may be getting its own random seed. Changing the number of threads would then change the random seed initialisation, thus generating different output. |
It's not the random seed. The random seed is only one in the main thread. The problem is more complex - the tensor operations are multi-threaded and based on the number of threads, they process different sizes of the input data. Since these are floating point numbers and they are often accumulated, the finite precision of floating-point operations causes the final results to be slightly different for different number of threads. This effect is amplified by the auto-regressive nature of the transformer. There are ways to fix this, but a major refactor in |
@BadisG |
@ggerganov I just tried with t = 14, 12 and 5 and I have the same result each time. |
Hello,
I simply wanted to bring up the point that the output can vary based on the number of threads selected, even if the seed stays constant.
I have an intel core i7 10700K that has 16 threads.
For this example I'm using the 13B model (./models/13B/ggml-model-q4_0.bin)
When I put -t 14 (make -j && ./main -m ./models/13B/ggml-model-q4_0.bin -p "Building a website can be done in 10 simple steps:" -t 14 -n 50 --seed 1678486056), I got this result:

When I put -t 15 (make -j && ./main -m ./models/13B/ggml-model-q4_0.bin -p "Building a website can be done in 10 simple steps:" -t 15 -n 50 --seed 1678486056), I got this result:

I have zero knowledge in machine learning, perhaps this is a normal behavior.
Looking forward for your reactions!
The text was updated successfully, but these errors were encountered: