Early: tested in QEMU, not yet on real boards

The model without a runtime

GGUFC compiles one GGUF model file into plain C99 that runs that one model on one CPU. There's no inference engine and no malloc, and the exact RAM is known before the program runs. The same output builds into a C library, a command-line chat, or an arm64 kernel image that boots in place of Linux.

GGUFC pipeline: a GGUF file and a target profile compile to a C99 project, which builds a hosted library, a freestanding library or a bootable arm64 kernel image

Predictable

Every shape is a constant and every buffer has a fixed place in one static block. The RAM is sizeof one struct, printed by the compiler.

Small

About 40 KB of generated code plus the weights. It builds freestanding, with no libc and no libm: GGUFC ships the few functions it needs.

The model is the kernel

QEMU's -kernel or a stock U-Boot booti loads the image like Linux. It sets up its own MMU, starts the cores and answers on the serial console.

Checked against llama.cpp

F32 builds match a pinned llama.cpp to 1e-3 on every position. Quantized builds pass a statistical gate calibrated on llama.cpp's own configurations.

Demos

Every demo runs a kernel image in QEMU on a development Mac, with no Linux, no libc and no audio stack in the VM. The sound in the videos is what QEMU recorded from the image's virtio-sound device. These are demos, not speed measurements.

Voice agent: three models in one 1.7 GB kernel image. Qwen3-ASR-0.6B hears the question, Qwen2.5-0.5B answers and Soprano-80M speaks.
With a voice: a chat model and a text-to-speech model in one image. The answer is printed, then spoken.
Qwen2.5-0.5B compiled to C, built into an arm64 kernel image, booted in QEMU on 4 cores and answering a question
Qwen2.5-0.5B (Q4_K_M) as a 382 MB kernel image, 4 cores. It answers, then powers the VM off.
The Qwen2.5-0.5B kernel image boots in QEMU into a chat on the serial console
Without a baked-in prompt, the image boots into a chat on the serial console. The KV cache keeps the turns.

Download

The ready-made images and weights below come from release v0.2.0. The generated C sources are in examples/prebuilt. To build them you need only a C compiler and make: no Rust and no GGUF.

FileWhat it isSizeSHA-256

Check a download with shasum -a 256 -c SHA256SUMS. A weights.bin works for every target of its model, and each model.h holds its CRC-32. You can also rebuild every file byte for byte with ggufc convert from the GGUF. All releases

Ready-made sources

DirectoryModelTargetBuildTested
smollm2-135m-q4_k_m-portable-cSmolLM2-135Many CPU, plain C99makemacOS arm64
smollm2-135m-q4_k_m-arm64SmolLM2-135Marm64 with dotprod (Apple silicon, Cortex-A76+)makemacOS arm64
qwen2.5-0.5b-q4_k_m-arm64Qwen2.5-0.5BsamemakemacOS arm64
smollm2-135m-q4_k_m-qemuSmolLM2-135MQEMU virt kernel image, 4 coresmake imageQEMU + HVF
qwen2.5-0.5b-q4_k_m-qemuQwen2.5-0.5Bsamemake imageQEMU + HVF
smollm2-135m-q4_k_m-raspi4SmolLM2-135MRaspberry Pi 4 kernel imagemake imageQEMU raspi4b only
smollm2-135m-q4_k_m-rk3588SmolLM2-135MRK3588 kernel image for U-Bootmake imagebuilds; no hardware yet
qwen2.5-0.5b-q4_k_m-rk3588Qwen2.5-0.5Bsamemake imagebuilds; no hardware yet

All of them use Q4_K_M and a 2048-token context. Both models are Apache-2.0. CI regenerates these sources on every push and fails if they differ from what's committed.

How to

Pick where you want the model to run.

Run a ready-made build with a C compiler and make. On x86 or older arm64, use smollm2-135m-q4_k_m-portable-c instead.

git clone https://github.com/antonellof/ggufc && cd ggufc
cd examples/prebuilt/smollm2-135m-q4_k_m-arm64
curl -L -o weights.bin https://github.com/antonellof/ggufc/releases/download/v0.2.0/smollm2-135m-q4_k_m-weights.bin
make
./build/model -p "What is the capital of France?"   # one answer
./build/model                                       # chat in the terminal

The program is a demo around a C library: model.c and model.h are all you need to embed the model in your own program (see the API).

Measured results

These numbers come from the development machine (Apple M5 Max), not a target board. Each one has a raw result file in bench/results. Speed per token is about the same as llama.cpp: decode is bound by memory bandwidth, so no speedup is claimed.

136 ms vs 258

Process start to first token, hosted, against llama.cpp b12952. SmolLM2-135M Q4_K_M, 4 threads.

119 MB vs 293

Peak RAM, same run.

42 KB vs 6,582

Program code, not counting the weights.

87 ms vs 238

QEMU launch to first answer byte: the kernel image against Linux 6.12 (minimal config) + llama.cpp in the same VM.

Benchmark: GGUFC against llama.cpp, SmolLM2-135M Q4_K_M, 4 threads
Power on to first answer: Linux plus llama.cpp, against the GGUFC image booted directly by U-Boot

Correctness

F32 builds match llama.cpp to 1e-3 on every position of 32 prompts: SmolLM2 at 6.9e-5, Qwen2.5 at 2.5e-4 and Llama 3.2 1B at 1.1e-4 (NEON). llama.cpp doesn't agree with itself across its own valid kernel configurations, so quantized builds are held to a different standard: they must not disagree with llama.cpp's default more than its other configuration does (McNemar and Mann-Whitney tests, KL < 0.01). All twelve Q8_0 and Q4_K_M builds pass. Kernel images give the same tokens and logits as the hosted build, bit for bit.

The generated library

The API is fixed. Every buffer lives in one static struct and every dimension is a compile-time constant.

#include "model.h"

static m_ctx ctx;                          /* every buffer of the model: sizeof = M_RAM_BYTES */
int32_t ids[M_CTX]; float logits[M_VOCAB]; int n = 0;
n += m_chat_prefix(M_ROLE_USER, ids + n, M_CTX - n);
n += m_tokenize("Why is the sky blue?", ids + n, M_CTX - n);
n += m_chat_prefix(M_ROLE_END, ids + n, M_CTX - n);
n += m_chat_prefix(M_ROLE_ASSISTANT, ids + n, M_CTX - n);
m_init(&ctx);
m_eval(&ctx, ids, n, logits);              /* prefill, then one call per decode step */
int32_t next = m_sample(logits, &cfg, &rng);
m_detokenize(next, text, sizeof text);

The generated code has no malloc, no recursion, no variable-length arrays and no file I/O outside the demo. It compiles clean with -std=c99 -Wall -Wextra -Wpedantic -Werror on gcc and clang. The output is deterministic: the same GGUF, target and compiler version give byte-identical files.

Status

WhereStatus
Hosted library and chat (macOS, Linux; arm64, x86)Works
Kernel image in QEMU, booted directly or by stock U-BootWorks, bit identical to hosted at 1 and 4 cores
Speech in and out on the kernel image (virtio-sound)Works in QEMU
Raspberry Pi 4Works in QEMU raspi4b; not yet on a real Pi
RK3588 / RK3588S boardsBoot path works in QEMU; hardware run next
Microcontroller instant-on (Cortex-M33 + RK3588)Planned
MicroVM cells (Firecracker, Unikraft)Planned

Tested models: SmolLM2-135M-Instruct, Qwen2.5-0.5B-Instruct, Llama-3.2-1B-Instruct, Qwen3-ASR-0.6B and Soprano-1.1-80M. Nothing here is production ready yet.