| ▲ | codingdave 5 hours ago |
| The discussions around this point are taking it too seriously, even when they are 100% correct. LLMs are not deterministic, so they are not compilers. Sure, if you specify everything - every tiny detail, you can often get them to mostly match. But not 100%. Even if you do fix that, at that point you are coding using English, which is an inefficient language for that level of detail in a specification. And even if you accept that problem, you still have gone to a ton of work just to fight the fundamental non-deterministic nature of LLMs. It all feels to me like the guys who make videos of using using electric drills to hammer in a nail - Sure, you can do that, but it is the wrong tool for the job. Everyone knows the phrase: "When all you have is a hammer, everything looks like a nail." But we need to also keep in mind the other side of that coin: "When all you have is nails, all you need is a hammer." LLMs are not a replacement for everything that happens to be digital. |
|
| ▲ | alpaylan 4 hours ago | parent | next [-] |
| I think the point I wanted to make was that even if it was deterministic (which you can technically make it to be I guess?) you still shouldn’t live in a world where you’re guided by the “guesses” that the model makes when solidifying your intent into concrete code. Discounting hallucinations (I know this a is a big preconception, I’m trying to make the argument from a disadvantaged point again), I think you need a stronger argument than determinism in the discussion against someone who claims they can write in English, no reason for code anymore; which is what I tried to make here. I get your point that I might be taking the discussion to seriously though. |
| |
| ▲ | liveoneggs 4 hours ago | parent | next [-] | | The future is about embracing absolute chaos. The great reveal of LLMs is that, for the most part, nothing actually mattered except the most shallow approximation of a thing. | | |
| ▲ | belZaah 2 hours ago | parent | next [-] | | This is true only for a small subset of problems. If you write crypto or hardware drivers, details do matter. | |
| ▲ | ModernMech 10 minutes ago | parent | prev | next [-] | | I think the exact opposite is true: LLMs revealed that when you average everything together, it's really bland and uninteresting no matter how technically good. It's the small choices that bring life into a thing and transform it from slop into something interesting and worthy of attention. | |
| ▲ | wizzwizz4 4 hours ago | parent | prev [-] | | The great reveal of LLMs is that our systems of checks and balances don't really work, and allow grifters to thrive, but despite that most people were actually trying to do their jobs properly. Perhaps nothing matters to you except the most shallow approximation of a thing, but there are usually people harmed by such negligence. | | |
| ▲ | liveoneggs 2 hours ago | parent | next [-] | | I'm just as upset as you are about it, believe me. Unfortunately I have to live in the world as I see it and what I've observed in the last 18-ish months is a complete breakdown of prior assumptions. | |
| ▲ | skydhash 3 hours ago | parent | prev [-] | | Imagine if the amount of a bank transfer does not matter, but it can only be an approximation, also you can approximate the selected account too. Or the system for monitoring the temperature of blood stockage for transfusion… Often it seems like tech maximalists are the most against tech reliability. | | |
| ▲ | wavemode 2 hours ago | parent | next [-] | | Well, the person who vibe-coded the banking app also vibe-coded a bunch of test cases, so this will only affect a small percentage of customers. When it does and they lose a bunch of money, well, you have a PR team and they don't, so just sweep the story under the rug. Imagine that - you got your project done ahead of schedule (which looks great on your OKRs) AND finally achieved your dream of no longer being dependent on those stupid overpaid, antisocial software engineers, and all it cost you was the company's reputation. Boeing management would be proud. Lots of business leaders will do the math and decide this is the way to operate from now on. | |
| ▲ | snovv_crash 3 hours ago | parent | prev | next [-] | | No need to be so practical. I suggest when their pointer dereferences, it can go a bit forward or backwards in memory as long as it is mostly correct. | |
| ▲ | SecretDreams 3 hours ago | parent | prev [-] | | Let's give people a choice. My banking will be deterministic, others can have probabilistic banking. Every so often, they transfer me some money by random chance, but at least they can say their banking is run by LLMs. Totally fair trade. |
|
|
| |
| ▲ | raw_anon_1111 2 hours ago | parent | prev | next [-] | | Before LLMs and now more than a decade ago in my career, I was assigned a task and my job was to translate that task into a working implementation. I was guided by the “guesses” that other developers made. I had to trust that they could do FizzBuzz competently without having to tell them to use the mod operator Then my job became I am assigned a larger implementation and depending on how large the implementation was, I had to design specifications for others to do some or all of the work and validate the final product for correctness. I definitely didn’t pore over every line of code - especially not for front end work that I stopped doing around the same time. The same is true for LLMs. I treat them like junior developers and slowly starting to treat them like halfway competent mid level ticket takers. | |
| ▲ | blazinglyfast 4 hours ago | parent | prev [-] | | > even if it was deterministic (which you can technically make it to be I guess?) No. LLMs are undefined behavior. | | |
| ▲ | xixixao 4 hours ago | parent [-] | | OP means “given the same input, produce the same output” determinism. This isn’t really much different from normal compilers, you might have a language spec, but at the end of the day the results are determined by the concrete compiler’s implementation. But most LLM services on purpose introduce randomness, so you don’t get the same result for the same input you control as a user. | | |
| ▲ | zaphar an hour ago | parent | next [-] | | You can get deterministic output if just turn the temperature all the way down. The problem is that you usually get really bad results, deterministically. It turns out the randomness helps in finding solutions. | | |
| ▲ | recursive 4 minutes ago | parent [-] | | You can also get deterministic output if you use whatever temperature you want and use an arbitrary fixed RNG seed. |
| |
| ▲ | 4 hours ago | parent | prev [-] | | [deleted] |
|
|
|
|
| ▲ | CGMthrowaway 4 hours ago | parent | prev | next [-] |
| >LLMs are not deterministic, so they are not compilers. "Deterministic" is not the the right constraint to introduce here. Plenty of software is non-deterministic (such as LLMs! But also, consensus protocols, request routing architecture, GPU kernels, etc) so why not compilers? What a compiler needs is not determinism, but semantic closure. A system is semantically closed if the meanings of its outputs are fully defined within the system, correctness can be evaluated internally and errors are decidable. LLMs are semantically open. A semantically closed compiler will never output nonsense, even if its output is nondeterministic. But two runs of a (semantically closed) nondeterministic compiler may produce two correct programs, one being faster on one CPU and the other faster on another. Or such a compiler can be useful for enhancing security, e.g. programs behave identically, resist fingerprinting. Nondeterminism simply means the compiler selects any element of an equivalence class. Semantic closure ensures the equivalence class is well‑defined. |
| |
| ▲ | thwarted 3 hours ago | parent | next [-] | | No, deterministic means that given the same inputs—source code, target architecture, optimization level, memory and runtime limits (because if the optimizer has more space/time it might find better optimizations), etc—a compiler will produce the same exact output. This is what reproducible builds is about: tightly controlling the inputs so the same output is produced. That a compiler might pick among different specific implementations in the same equivalency class is exactly what you want a multi-architecture optimizing compiler to do. You don't want it choosing randomly between different optimization choices within an optimization level, that would be non-deterministic at compile time and largely useless assuming that there is at most one most optimized equivalent. I always want the compiler to choose to xor a register with itself to clear it if that's faster than explicitly setting it to zero if that makes the most sense to do given the inputs/constraints. | | |
| ▲ | CGMthrowaway 2 hours ago | parent | next [-] | | Determinism may be required for some compiler use cases, such as reproducible builds, and several replies have pointed that out. My point isn't that determinism is unimportant, but that it isn't intrinsic to compilation itself. There are legitimate compiler use cases e.g. search‑based optimization, superoptimization, diversification etc where reproducibility is not the main constraint. It's worth leaving conceptual space for those use cases rather than treating deterministic output as a defining property of all compilers | |
| ▲ | sureglymop 2 hours ago | parent | prev [-] | | Don't LLMs create the same outputs based on the same inputs if the temperature is 0? Maybe I'm just misunderstanding. | | |
| |
| ▲ | moregrist 3 hours ago | parent | prev | next [-] | | Perhaps you're comfortable with a compiler that generates different code every time you run it on the same source with the same libraries (and versions) and the same OS. I am not. To me that describes a debugging fiasco. I don't want "semantic closure," I want correctness and exact repeatability. | | |
| ▲ | candiddevmike 3 hours ago | parent | next [-] | | I wish these folks would tell me how you would do a reproducible build, or reproducible anything really, with LLMs. Even monkeying with temperature, different runs will still introduce subtle changes that would change the hash. | | |
| ▲ | mvr123456 3 hours ago | parent | next [-] | | This reminds me of how you can create fair coins from biased ones and vice versa. You toss your coin repeatedly, and then get the singular "result" in some way by encoding/decoding the sequence. Different sequences might map to the same result, and so comparing results is not the same as comparing the sequences. Meanwhile, you press the "shuffle" button, and code-gen creates different code. But this isn't necessarily the part that's supposed to be reproducible, and isn't how you actually go about comparing the output. Instead, maybe two different rounds of code-generation are "equal" if the test-suite passes for both. Not precisely the equivalence-class stuff parent is talking about, but it's simple way of thinking about it that might be helpful | |
| ▲ | cjbgkagh 3 hours ago | parent | prev [-] | | There is nothing intrinsic to LLM prevents reproducibility. You can run them deterministically without adding noise, it would just be a lot slower to have a deterministic order of operations, which takes an already bad idea and makes it worse. | | |
| ▲ | candiddevmike 3 hours ago | parent [-] | | Please tell me how to do this with any of the inference providers or a tool like llama.cpp, and make it work across machines/GPUs. I think you could maybe get close to deterministic output, but you'll always risk having some level of randomness in the output. | | |
| ▲ | cjbgkagh 2 hours ago | parent | next [-] | | Just because you can’t do it with your chosen tools it does not mean it cannot be done. I’ve already granted the premise that it is impractical. Unless there is a framework that already guarantees determinism you’ll have to roll your own, which honestly isn’t that hard to do. You won’t get competitive performance but that’s already being sacrificed for determinism so you wouldn’t get that anyway. | |
| ▲ | wat10000 12 minutes ago | parent | prev [-] | | It's just arithmetic, and computer arithmetic is deterministic. On a practical level, existing implementations are nondeterministic because they don't take care to always perform mathematically commutative operations in the same order every time. Floating-point arithmetic is not commutative, so those variations change the output. It's absolutely possible to fix this and perform the operations in the same order every time, implementors just don't bother. It's not very useful, especially when almost everything runs with a non-zero temperature. I think the whole nondeterminism thing is overblown anyway. Mathematical nondeterminism and practical nondeterminism aren't the same thing. With a compiler, it's not just that identical input produces identical output. It's also that semantically identical input produces semantically identical output. If I add an extra space somewhere whitespace isn't significant in the language I'm using, this should not change the output (aside from debug info that includes column numbers, anyway). My deterministic JSON decoder should not only decode the same values for two runs on identical JSON, a change in one value in the input should produce the same values in the output except for the one that changed. LLMs inherently fail at this regardless of temperature or determinism. |
|
|
| |
| ▲ | SecretDreams 3 hours ago | parent | prev [-] | | Agree. I'm not sure what circle of software hell the OP is advocating for. We need consistent outputs from our most basic building blocks. Not performance probability functions. Many softwares run congruently across multiple nodes. What a nightmare it would be if you had to balance that for identical hardware. |
| |
| ▲ | bigstrat2003 3 hours ago | parent | prev | next [-] | | > What a compiler needs is not determinism, but semantic closure. No, a compiler needs determinism. The article is quite correct on this point: if you can't trust that the output of a tool will be consistent, you can't use it as a building block. A stochastic compiler is simply not fit for purpose. | | |
| ▲ | hackinthebochs 2 hours ago | parent [-] | | Compiler output can be inconsistent and correct. For any source code there is an infinite number of machine code sequences that maintain the semantic constraints of the source code. Correctness is defined semantically, not by consistency. |
| |
| ▲ | cv5005 3 hours ago | parent | prev | next [-] | | Bitwise identical output from a compiler is important for verification to protect against tampering, supply chain attacks, etc. | |
| ▲ | tjr 3 hours ago | parent | prev [-] | | Sometimes determinism is exactly what one wants. For avionics software, being able to claim complete equivalence between two builds (minus an expected, manually-inspected timestamp) is used to show that the same software was used / present in both cases, which helps avoid redundant testing, and ensure known-repeatable system setups. |
|
|
| ▲ | bee_rider 4 hours ago | parent | prev | next [-] |
| Are conventional compilers actually deterministic, with all the bells and whistles enabled? PGO seems like it ought to have a random element. |
| |
| ▲ | pjmlp 31 minutes ago | parent | next [-] | | Not at all, when talking about managed runtimes. Hence why it is hard to do benchmarks with various kinds of GC and dynamic compilers. You can't even expect deterministic code generation for the same source code across various compilers. | |
| ▲ | jcranmer 2 hours ago | parent | prev | next [-] | | It is generally considered a bug in a compiler if its output is nondeterministic. Of course, compilers are large, complex beasts, and nondeterminism is so easy to accidentally introduce (e.g., do a "for each" in a map where the key is a pointer), that it's probably not too hard to find cases that have nondeterminism. > PGO seems like it ought to have a random element. PGO should be deterministic based on the runs used to generate the profile. The runs are tracking information that should be deterministic--how many times does the the branch get taken versus not taken, etc. HWPGO, which relies on hardware counters to generate profiling information, may be less deterministic because the hardware counters end up having some statistical slip to them. | |
| ▲ | vlovich123 3 hours ago | parent | prev | next [-] | | No, modulo bugs generally the same set of inputs to a compiler are guaranteed to produce the same output bit for bit which is the definition of determinism. There’s even efforts to guarantee this for many packages on Linux - it’s a core property of security because it lets you validate that the compilation process or environment wasn’t tampered with illicitly by being able to verify by building from scratch. Now actually managing to fix all inputs and getting deterministic output can be challenging, but that’s less to do with the compiler and more to do with the challenge of completely taking the entire environment (the profile you are using for PGO, isolating paths on the build machine being injected into the binary, programs that have things in their source or build system that’s non deterministic (e.g. incorporating the build time into the binary) | |
| ▲ | 123malware321 3 hours ago | parent | prev | next [-] | | well considering you use components like DFA to build compilers, yes they are determenistic. you also have reproducible builds etc. or does your binary always come out differently each time you compile the same file?? You can try it. try to compile the same file 10 times and diff the resultant binaries. Now try to prompt a bunch of LLMs 10 times and diff the returned rubbish. | | |
| ▲ | sigbottle 3 hours ago | parent [-] | | I think one of the best ways to understand the "nice property" of compilers we like isn't necessarily determinacy, but "programming models". There's this really good blog post about how autovectorization is not a programming model https://pharr.org/matt/blog/2018/04/18/ispc-origins The point is that you want to reliably express semantics in the top level language, tool, API etc. because that's the only way you can build a stable mental model on top of that. Needing to worry about if something actually did something under the hood is awful. Now of course, that depends on the level of granularity YOU want. When writing plain code, even if it's expressively rich in the logic and semantics (e.g. c++ template metaprogramming), sometimes I don't necessarily care about the specific linker and assembly details (but sometimes I do!) The issue I think is that building a reliable mental model of an LLM is hard. Note that "reliable" is the key word - consistent. Be it consistently good or bad. The frustrating thing is that it can sometimes deliver great value and sometimes brick horribly and we don't have a good idea for the mental model yet. To constrain said possibility space, we tether to absolute memes (LLMs are fully stupid or LLMs are a superset of humans). Idk where I'm going with this |
| |
| ▲ | candiddevmike 3 hours ago | parent | prev [-] | | Yes, they will output the same file hash every time, short of some build time mutation. Thus we can have nice things like reproducible builds and integrity checks. |
|
|
| ▲ | WithinReason 4 hours ago | parent | prev | next [-] |
| LLMs are deterministic at minimal temperature. Talking about determinism completely misses the point. The human brain is also non-deterministic and I don't see anybody dismiss human written code based on that. If you remove randomness and choose tokens deterministically, that doesn't magically solve the problems of LLMs. |
| |
| ▲ | SecretDreams 3 hours ago | parent [-] | | > The human brain is also non-deterministic and I don't see anybody dismiss human written code based on that. Humans, in all their non deterministic brain glory, long ago realized they don't want their software to behave like their coworkers after a couple of margaritas. | | |
| ▲ | WithinReason 3 hours ago | parent [-] | | You seem to be under the impression that I'm promoting LLMs, not sure where you got that idea. The argument is that non-determinism has nothing to do with the issues of LLMs. |
|
|
|
| ▲ | 9rx 3 hours ago | parent | prev [-] |
| > LLMs are not deterministic They are designed to be where temperature=0. Some hardware configurations are known defy that assumption, but when running on perfect hardware they most definitely are. What you call compilers are also nondeterministic on 'faulty' hardware, so... |
| |
| ▲ | xigoi an hour ago | parent | next [-] | | While they’re technically deterministic, they’re still chaotic, in the sense that changing irrelevant details in the input (such as writing “color” versus “colour”) can make the output completely different. | |
| ▲ | vlovich123 3 hours ago | parent | prev | next [-] | | Even with temperature and a batch size of 1 and fixed seed LLMs should be deterministic. Of course batch size of 1 is not economical. | |
| ▲ | troupo 3 hours ago | parent | prev [-] | | with temperature=0 and no context. That is, a clean run with t=0, pk=0 etc. etc. will produce the same output for the same question. However if you ask the same question in the same session, output will be different. To say the least, this is garbage compared to compilers | | |
| ▲ | 9rx 2 hours ago | parent [-] | | > However if you ask the same question in the same session, output will be different. When isn't that true? int main() {
printf("Continue?\n");
}
and int main() {
printf("Continue?\n");
printf("Continue?\n");
}
do not see the compiler produce equivalent outputs and I am not sure how they ever could. They are not equivalent programs. Adding additional instructions to a program is expected to see a change in what the compiler does with the program. |
|
|