Neuro-Symbolic Code Generation via S-Expression Intermediate Representation and Deterministic Harness Engineering
Description
Current AI-assisted code generation follows an autoregressive token-prediction paradigm where large language models (LLMs) freely generate source code, resulting in frequent compilation failures due to type errors, undefined references, and hallucinated APIs. We present Neural Codegen, a neuro-symbolic architecture that constrains LLMs to output S-expressions (a minimal, homoiconic DSL), validates the output against a typed intermediate representation (IR) defined as Rust enum whitelists, and deterministically assembles guaranteed-compilable Rust code via pre-verified template composition. We call this the "GPU mode" of code generation: the LLM selects from a finite instruction set rather than creating in an unbounded code space. In benchmarks against Claude 4.6 Opus generating Rust directly, the pipeline achieves a 75% Pass@1 compilation rate versus 62% for raw LLM generation. We further describe the intent-reality-delta (IRD) closed loop implemented in the Jarvis system, where both architectural specification and physical codebase are represented as S-expressions and compared by a pure deterministic algorithm. We position this work within the emerging discipline of harness engineering, arguing that the moat in agentic software development is the harness, not the model.
Files
paper.pdf
Files
(49.6 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:9e87528307c7872482279f151ae6def0
|
49.6 kB | Preview Download |