|
| 1 | ++++ |
| 2 | +title = "AI & Compilers" |
| 3 | +description = """\ |
| 4 | + In this essay, Carson Gross discusses whether or not current AI tools are similar to early compilers""" |
| 5 | +date = 2026-03-18 |
| 6 | +updated = 2026-03-18 |
| 7 | +authors = ["Carson Gross"] |
| 8 | +[taxonomies] |
| 9 | +tag = ["posts"] |
| 10 | ++++ |
| 11 | + |
| 12 | +A common refrain that we hear today is that the move to AI-based tools for coding is like the move from assembly to |
| 13 | +high level programming languages [using compilers](https://x.com/Steve_Yegge/status/1966230719212220457). In |
| 14 | +["Yes, and..."](@/essays/yes-and.md) I mentioned that I don't agree with that simile and in this essay, after a conversation |
| 15 | +with a good friend on the topic, I want to expand on that idea. |
| 16 | + |
| 17 | +## LLMs Are Not Deterministic |
| 18 | + |
| 19 | +In ["Yes, and..."](@/essays/yes-and.md) I make the point that LLMs are stochastic systems and compilers are not. This alone should make any |
| 20 | +direct comparison between the two technologies suspect, but it bears repeating: given the same input, compilers should |
| 21 | +produce the same output in a deterministic manner, whereas LLMs are designed explicitly to (statistically speaking) |
| 22 | +*not* give the same output. |
| 23 | + |
| 24 | +## Prompts Are Not Source Code |
| 25 | + |
| 26 | +Another major difference between the move to high level languages and AI tools today builds on the first observation: |
| 27 | +prompts are not source code. |
| 28 | + |
| 29 | +Prompts are not typically saved alongside the resulting actual code. Sometimes design documents are stored alongside |
| 30 | +the actual code and are fed into LLMs to continue working on a given area of code, but the entire series of prompts that |
| 31 | +lead to the current state of the codebase is typically not captured. |
| 32 | + |
| 33 | +Even if the entire series _was_ captured, because of point 1, there isn't any mechanism for deterministically understanding |
| 34 | +why the code is in the state that it currently is in. |
| 35 | + |
| 36 | +Again, this contrasts with the way that compilers work: you have the entire high-level language source for a project, you |
| 37 | +compile it into an executable (or bytecode or whatever.) |
| 38 | + |
| 39 | +Now, there may be decisions in the high-level language that are not obvious given the current state of the high-level code |
| 40 | +but that's the point: the high-level code is _there_, in your codebase, in a way that prompts are not. |
| 41 | + |
| 42 | +## You Can't Debug A Prompt |
| 43 | + |
| 44 | +High-level languages have a wonderful tool associated with them called [a debugger](https://en.wikipedia.org/wiki/Debugger), |
| 45 | +which lets you step through code in a high-level language and "watch" what happens. |
| 46 | + |
| 47 | +This is possible because of the deterministic relationship between high-level code and the actual operations occurring |
| 48 | +in the underlying machine (or virtual machine) which allows a mapping between the two. |
| 49 | + |
| 50 | +Such a mapping cannot exist between prompts and running code. |
| 51 | + |
| 52 | +In fact, "debugging a prompt", if it makes any sense at all, probably sounds like a code-time activity rather than |
| 53 | +either a compile time or runtime activity to most people reading this, which is telling. |
| 54 | + |
| 55 | +## "I haven't written any code in months!" |
| 56 | + |
| 57 | +I see people saying this, but they are engaged in a sleight of hand, intentionally or not. They _have_ written code (often |
| 58 | +lots of code!) in the past few months, they just haven't _typed_ that code. |
| 59 | + |
| 60 | +The actual artifacts on disk, the "source of truth" is _still_ the code that they generated (and perhaps |
| 61 | +[do not understand](https://www.youtube.com/watch?v=GFiWEjCedzY).) |
| 62 | + |
| 63 | +If something is wrong, and you want to understand what it is, you _have_ to read the code. The prompts made the code |
| 64 | +but the prompts are gone, leaving only the code and perhaps some tests for you to work from. |
| 65 | + |
| 66 | +Someone might reply that they will just have an LLM read the code, which is a plausible response but again differentiates |
| 67 | +AI from high-level programming languages. |
| 68 | + |
| 69 | +## Code Complexity Still Matters |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +## This is not an Anti-AI Essay |
| 74 | + |
| 75 | +Again, as I said in "Yes, and...", I am not anti-AI, and I am figuring out how to effectively use AI in my own coding |
| 76 | +workflows. I tend to use it in an exploratory manner and as a coding assistant, rather than as a code-generator. My |
| 77 | +experience with code generated by AI is mixed: sometimes it does a decent job, often it doesn't. But that is my own |
| 78 | +experience and involves some subjectivity around what is decent code and what isn't. |
| 79 | + |
| 80 | +My point is not that AI is bad, but rather that simplistic mappings of AI-based coding onto the shift to high-level languages |
| 81 | +is, at the current time, wrong-headed and misleading. Maybe we will develop AI-native languages that allow us to specify |
| 82 | +systems deterministically using much higher level language[^1]. |
| 83 | + |
| 84 | +But until we start seeing things like that we should be skeptical of people who claim |
| 85 | + |
| 86 | + |
| 87 | +[^1] - Personally, I think that's called lisp and, despite that, I still choose to code in java. |
0 commit comments