Torvalds: "100% of Their Code Is Written by Compilers" Too. The Linux creator argued that AI-written code claims are misleading — and warned that a wave of low-quality, AI-generated bug reports is quietly burning out the maintainers who keep open source running.
An LLM is not inherently non-deterministic though - if you don’t randomly sample and instead have a fixed rule (which is what the recent fingerprint embedding approach does), if applied in all cases the output is deterministic, as the neural net at its core is deterministic function. A lot of the randomness beyond that is due to optimizations [source].
LLMs are however unreliable at ‘compiling’. Whether or not it will be able to complete the requested task (translate human language into code) correctly it not guaranteed - at least nowhere near the compilers we use.
While they can be deterministic in runtime they can be compared to cryptographic hashes in that they come preloaded with pseudorandomness which will behave unpredictably
If you do that it will basically produce the most average possible output, given the context. I don’t know if that’s going to be useful in a compiler context…
C/C++ compilers are non deterministic due to support of super macros that change run to run, non-deterministic optimisation strategies or ordering due to parallelism, and linkers often produce different outputs every time they are run where subtle bugs can cause crashes when addresses don’t line up how you expect. And that’s without mentioning projects that use a configuration step.
It’s actually a big problem in producing reproducible builds for security.
Can’t most serious compilers produce reproducible builds these days given the same build environment. I know there has been a drive towards reproducible builds in general for security verification purposes.
Not by default usually but yes, you need to do a lot of work to set all necessary configurations and sometimes provide your own RNG seed for things which insist on random looking values.
I’m not very good with C/C++ so please correct me, isn’t that what’s called a “race condition”? Parallelism can cause non-determinism but not in the same sense LLMs generate non-deterministic output. Compilers are not statistical machines.
From my understanding, which is very limited, race conditions are more an issue with concurrent programming. Parallel computing uses separate processor cores for each task so there’s less reliance on stack machines. But I guess each core still shares the memory, so maybe it still happens. Like I said, my understanding is limited. Just use rust.
You don’t need parallelism to have a race condition, just not handling an event with expected timing can cause one - like when two keys are pressed within one polling cycle and you depend on one being pressed before the other for some logic like up and right arrow for a diagonal but they register as right and up so the diagonal movement doesn’t trigger
Compiler optimisation strategies sometimes use statistical machines and link time optimisation does use random number generators for producing output
Exactly this. If you made an LLM that had deterministic code output then I’m all up for saying “AI is a compiler for human language”. But until then AI is most definitely not a compiler.
Never seen a non-deterministic compiler though
Or one that pretends compilation was a success when it wasn’t.
Technically, LLMs (and most ML models) are deterministic with the same input and same seed.
I get what you mean though.
So does ChatGPT intentionally change seed at every interaction so it always spits two different outputs given the same input?
In short: yes. You can tune these values when self hosting - it basically changes the b chance which tokens will be used under which circumstances.
Yeah, that sounds like a disaster waiting to happen…
An LLM is not inherently non-deterministic though - if you don’t randomly sample and instead have a fixed rule (which is what the recent fingerprint embedding approach does), if applied in all cases the output is deterministic, as the neural net at its core is deterministic function. A lot of the randomness beyond that is due to optimizations [source].
LLMs are however unreliable at ‘compiling’. Whether or not it will be able to complete the requested task (translate human language into code) correctly it not guaranteed - at least nowhere near the compilers we use.
While they can be deterministic in runtime they can be compared to cryptographic hashes in that they come preloaded with pseudorandomness which will behave unpredictably
There is a parameter in llms called temperature. If you reduce it down to zero it will become deterministic. And probably even worse.
Yeah but the output would be crap. Just use the same prng seed and you’ll get reproducible output.
If you do that it will basically produce the most average possible output, given the context. I don’t know if that’s going to be useful in a compiler context…
C/C++ compilers are non deterministic due to support of super macros that change run to run, non-deterministic optimisation strategies or ordering due to parallelism, and linkers often produce different outputs every time they are run where subtle bugs can cause crashes when addresses don’t line up how you expect. And that’s without mentioning projects that use a configuration step.
It’s actually a big problem in producing reproducible builds for security.
Can’t most serious compilers produce reproducible builds these days given the same build environment. I know there has been a drive towards reproducible builds in general for security verification purposes.
Not by default usually but yes, you need to do a lot of work to set all necessary configurations and sometimes provide your own RNG seed for things which insist on random looking values.
I’m not very good with C/C++ so please correct me, isn’t that what’s called a “race condition”? Parallelism can cause non-determinism but not in the same sense LLMs generate non-deterministic output. Compilers are not statistical machines.
From my understanding, which is very limited, race conditions are more an issue with concurrent programming. Parallel computing uses separate processor cores for each task so there’s less reliance on stack machines. But I guess each core still shares the memory, so maybe it still happens. Like I said, my understanding is limited. Just use rust.
You don’t need parallelism to have a race condition, just not handling an event with expected timing can cause one - like when two keys are pressed within one polling cycle and you depend on one being pressed before the other for some logic like up and right arrow for a diagonal but they register as right and up so the diagonal movement doesn’t trigger
Compiler optimisation strategies sometimes use statistical machines and link time optimisation does use random number generators for producing output
Exactly this. If you made an LLM that had deterministic code output then I’m all up for saying “AI is a compiler for human language”. But until then AI is most definitely not a compiler.
Setting the temperature parameter to 0.00 makes an LLM deterministic.