LLMs as a Compiler
byKadhir Manickam
(3 minutes)
<section data-section-id='8c758025-bac1-4de1-941b-6b6374ba9b01'><p><span style="white-space: pre-wrap;">[2025-07-02]</span></p><p><br></p><p><span style="white-space: pre-wrap;">So far, I've only used LLMs as assistants, where I'm doing something and an LLM helps me along the way. Code autocomplete feels like a great example of how useful it can be when it gets it right. I don't doubt that this will improve over time, but I'm excited to see a more significant transition from this assistant mode to a compiler mode, at least for coding.</span></p><p><br></p><p><span style="white-space: pre-wrap;">It will be exciting when we focus solely on the context we fed the LLM, then test the features it generates rather than the code. And importantly, we let the LLM handle integrating new features into the existing codebase. That means we no longer examine the code. Our time as engineers will be spent handling context, testing features, and iterating on them.</span></p><p><br></p><p><span style="white-space: pre-wrap;">The consequence of that seems to be:</span></p><ul><li value="1"><b><strong style="white-space: pre-wrap;">Democratize access to engineering</strong></b><ul><li value="1"><span style="white-space: pre-wrap;">You don't need as specialized skillsets to build complex apps, you just need to know how to put context together and iterate</span></li></ul></li><li value="2"><b><strong style="white-space: pre-wrap;">Increase the velocity of feature development</strong></b><ul><li value="1"><span style="white-space: pre-wrap;">My gut says dealing with context will result in a better ratio of engineering time into features shipped than dealing with code directly</span></li></ul></li></ul><p><br></p><p><span style="white-space: pre-wrap;">The obvious pushback here is, well, compilers are provable. There's a straightforward mapping between inputs and outputs, and we can prove the outputs are the same each time. We can also write tests to ensure the outputs are optimized.</span></p><p><br></p><p><span style="white-space: pre-wrap;">But if we squint, a compiler transforms an input into an output. If we treat the code as an intermediate layer, viewing the input as context and the output as features, we can demonstrate the compiler's reliability through evaluation and testing. And importantly, we don't have to get the output right in the first go, we can let it iterate over and over until it gets it right. A new kind of compiler.</span></p><p><br></p><p><span style="white-space: pre-wrap;">So I propose that if we get LLM-as-a-compiler, as a software engineer, I will go through this cycle:</span></p><ol><li value="1"><span style="white-space: pre-wrap;">Put together the context</span><ol><li value="1"><span style="white-space: pre-wrap;">Which includes a series of tests for the final behavior (perhaps I use an LLM for this)</span></li></ol></li><li value="2"><span style="white-space: pre-wrap;">I put it through the LLM compiler</span><ol><li value="1"><span style="white-space: pre-wrap;">Which is probably a system composed of several things</span></li></ol></li><li value="3"><span style="white-space: pre-wrap;">Which continually iterates on the output until all the tests pass</span><ol><li value="1"><span style="white-space: pre-wrap;">Ideally, as the LLM compiler gets better, the latency gets lower and lower</span></li></ol></li><li value="4"><span style="white-space: pre-wrap;">We cache the output (code) for performance improvements</span></li><li value="5"><span style="white-space: pre-wrap;">I decide how I need to edit the context, and go back to step 1</span></li></ol><mermaid data-height="320">
flowchart LR
A[Put togetherthe context] --> B[LLM compiler]
B --> C{Tests pass?}
C -->|No| B
C -->|Yes| D[Cache the output]
D --> E[Edit the context]
E --> A
</mermaid><p><br></p><p><span style="white-space: pre-wrap;">SWE agents feel like they're the right abstraction on this path; they convert context into features, iterating in the background. They feel like they'll be an integral part of the LLM compiler system, which I think will have the following pieces:</span></p><ul><li value="1"><b><strong style="white-space: pre-wrap;">A way to specify the context of my app</strong></b><ul><li value="1"><span style="white-space: pre-wrap;">And a way to specify which part of my context to focus on</span></li></ul></li><li value="2"><b><strong style="white-space: pre-wrap;">Mechanism for specifying my reward signal (my tests)</strong></b></li><li value="3"><b><strong style="white-space: pre-wrap;">A system for monitoring the changes happening</strong></b><ul><li value="1"><span style="white-space: pre-wrap;">And a way to redirect parts of the compiler if it's not doing what I expect</span></li><li value="2"><span style="white-space: pre-wrap;">Over time, I'd expect this part to evolve and the need to see the code to reduce</span></li></ul></li></ul><p><br></p><h3><span style="white-space: pre-wrap;">Resources</span></h3><ol><li value="1"><span style="white-space: pre-wrap;">Vivek Haldar - LLMs are compilers</span><web-citation data-url="https://vivekhaldar.com/articles/llms-are-compilers/" data-title="Vivek Haldar - LLMs are compilers"></web-citation></li><li value="2"><span style="white-space: pre-wrap;">Dave Hoover - LLM as Compiler</span><web-citation data-url="https://medium.com/redsquirrel-tech/llm-as-compiler-2a2f79d30f0b" data-title="Dave Hoover - LLM as Compiler"></web-citation></li><li value="3"><span style="white-space: pre-wrap;">Avik Das - LLMs are like compilers, sort of</span><web-citation data-url="https://avikdas.com/2025/05/05/llms-are-like-compilers-sort-of.html" data-title="Avik Das - LLMs are like compilers, sort of"></web-citation></li></ol></section>