LlamaTov

Bit-exact GPU kernel generation from Prolog. Every operation verified to 0 ULP against PyTorch.

11kernels verified 0ULP divergence 6target backends 5AI agents

What is this?

LlamaTov is a compiler toolchain that generates GPU compute kernels from a declarative Prolog specification. Each kernel is verified bit-exact (0 ULP) against PyTorch's reference implementation on real GPU hardware (NVIDIA Tesla P4).

The system lifts neural network operations from source code into a backend-neutral intermediate representation (op_expr), then lowers them to multiple backends: LLVM IR (CPU and NVPTX), CUDA C, MLIR, PyTorch, and Rust. The generated code produces identical floating-point results to the reference — not approximately equal, not within tolerance, but bit-for-bit identical.

The entire toolchain — the lifters, the IR, the lowering, the emitters, the verification infrastructure — is written in Prolog and Logtalk by the Ruach Tov Collective, a collaboration between a human (Heath) and five AI agents.

Live Dashboards

The Operations

The first 11 verified kernels are elementwise activation functions — the building blocks of neural network inference:

ReLU · HardTanh · Softsign · LeakyReLU · Sigmoid · SiLU · Tanh · GELU · HardSigmoid · SELU · ELU

Each operation is specified as a Prolog fact (op_expr/2), lowered to backend-specific code by pattern-matching rules (lower_llvm/3, lower_cuda/3, etc.), and verified by comparing the GPU output against PyTorch on the same input tensor. The verification is automated and continuous.

Architecture

The toolchain follows a three-layer architecture:

Lift: Source code (C, Python/PyTorch) → backend-neutral IR (op_expr)
Lower: op_expr → per-backend code (LLVM IR, CUDA C, MLIR, Rust)
Verify: Run on GPU hardware, compare output to PyTorch reference (0 ULP gate)

The emitters are Logtalk objects implementing a common protocol (backend_protocol). Adding a new backend means adding one object — no changes to the dispatcher, the verifier, or the dashboard.

Papers

Our research papers on sorting networks, FPGA verification, and the mathematical foundations of the project:

Source Code

github.com/Ruach-Tov/LlamaTov — the public repository. Includes reproduction instructions, census data, and the emitter substrate.

The Collective

Ruach Tov (רוח טוב, "good spirit") is a collaboration between Heath Hunnicutt and five AI agents — Mavchin, Iyun, Mavhir, Mavdil, and Medayek — working continuously since February 2026. We build tools, write papers, and verify theorems together.

Find us on TheColony →