Hacker News new | ask | show | jobs
by sdevonoes 21 hours ago
Compilers also write code (they write machine code based on high level langs)… yet nobody asked the same question about them (or did they?)

AI needs to be instructed and then some kind of verification of the output is needed. Programmers do that

1 comments

Bad analogy. Compilers don't reason, they don't hallucinate. They take the language as given and "compile" it to the equivalent binary based on strict definitions in the language. It's reproducible and consistent. Saying they write code is factually wrong, at best they translate it.

AI will do the same thing in multiple ways or veer of course and do it another way based on spoken language with no strict syntax. It will make logical leaps, it will guess, it will assume etc.

These things are not equivalent at all.

The analogy is fine. AI moves us up to a higher level language, and it is understood that higher level languages come with their own leaky abstractions, but the idea remain the same. It is different, but only to the extent that would be expected from stepping up to the next higher level. It's not something completely different. We don't yet have AGI that will magically produce the software before you even knew you needed it. We still need a programmer to write the programs.
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.

>> 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.