Hacker News new | ask | show | jobs
by duncanfwalker 19 hours ago
It might not be the perfect analogy, but it does show some important parallels and differences. Compilers reason to some extent - for example type inference is definitely some deductive reasoning that I would have to do if the compiler didn't do it for me.

The hallucinations point is a difference and one that we haven't quite learnt to handle yet. Generally, compilers are deterministic (even it it might not feel like it sometimes) and there's a lot of useful properties that come from that.

I have recently put Claude into a CI/CD pipeline and it's made me realise how much I rely on pipelines being deterministic.

2 comments

>> Compilers reason to some extent - for example type inference is definitely some deductive reasoning that I would have to do if the compiler didn't do it for me. <<

But this "reasoning" is done within a strict ruleset and includes "just find the optimum in X", and there is no space for "language interpretation", so I wouldnt call this reasoning compared to that type what LLMs are doing.

LLMs operate with fewer constraints and consequently a larger search space, but there is an apparent continuum seen in programming where constraints are relaxed and the search space grows. It's not just standard compilers and LLMs. There is a whole world of computer science found in-between.

In order to consider LLMs to be something different then there needs to be a clear dividing line and I'm not sure that there is. It seems more likely that it is the same type of reasoning, but that LLMs take it to a further degree.

> Generally, compilers are deterministic

Not really. Maybe more so than they used to be thanks to deterministic algorithms becoming faster, but most compilers still aren't deterministic by default. There are still advantages to non-determinism in compilers, like not having to worry about thread execution order. To be fair, most compilers these days allow you to optionally enable determinism. Then again, LLMs also allow you to optionally enable determinism.

Thread-connected non-determinism is not what the author meant by "compilers are deterministic"
If you consider hidden inputs to be part of the input space then the statement is obviously true, but then all computation is deterministic. It is fundamentally impossible for computers to be anything but deterministic. Maybe that is what the author meant, but it seems unlikely as it doesn't add anything. Mentioning determinism usually implies that there is an non-deterministic alternative, which in computing can only mean where there are hidden inputs.
> LLMs also allow you to optionally enable determinism

really? Please explain

What's in need of explanation? Computers are designed to be deterministic, and LLMs run on computers, so LLMs must also be deterministic.

There caveat to that is where external inputs give the illusion of non-determinism. Thread execution order, like we already discussed, is one such example. Technically still deterministic if you understand the external inputs, but for the sake of discussion we can consider external inputs to be non-deterministic. Which is why compilers usually end up being non-deterministic by default. However, computers are designed to be deterministic so there are ways to avoid introducing those external inputs, albeit often at the cost of performance. LLMs and compilers alike can be run deterministically.

LLMs have one additional property not typically found in a traditional compiler — a call to rand() — but rand() is also deterministic when configured with a constant seed and can also be turned off completely by setting temperature to 0.

Ok, technically you’re right. You can make LLMs deterministic if you make literally every other aspect of execution deterministic as well - self-hosting and open-weights model with identical, reproducible logits, batching, FP math, etc.
Yup. Just as you can technically make compilers deterministic if you control all aspects of execution, but it isn't typical to do so. In fairness, reproducible builds have started to become considered increasingly important recently over concerns like supply chain attacks so attitudes are starting to change, which is why most compilers nowadays give you determinism as an option, but the historical view was that the user didn't really care what the compiler spit out, so there was rarely any effort to make them deterministic.

What's old is new again. LLMs are back to believing that the user doesn't really care what gets spit out, preferring performance over determinism, but it is likely that eventually we'll find increasing importance in reproducible builds again — especially when, like we saw with compilers, the hardware/algorithms catch up and the performance cost of determinism isn't there anymore. The industry is highly cyclical. These aren't hard technical limitations, just human choices mixed with a humorous dose of "this time is different". But in hindsight the times never end up being different, do they?