loom.cpp: AI on a $20 computer
Flávio Eler De Melo
OVOS Contributor
As published on Hugging Face: https://huggingface.co/blog/fdemelo/loom-cpp-ai-on-a-20-dollars-computer
Speech, audio and language models on everything from a GPU to a Raspberry Pi Zero.
One self-describing GGUF per model · an engine that hardcodes no model · built on ggml
TL;DR: loom.cpp is a small inference engine, built on ggml, for speech recognition, text to speech, voice activity, speaker and language ID, audio codecs, music and small language models, on anything from a GPU down to a Raspberry Pi Zero. Every model is one GGUF file that carries its own compute graphs and the script that drives them, so no model's network or decode loop is compiled into the engine. 77 models are ready to run on huggingface.co/loom-ai-org.
import loom # pip install "loom-py-rt[hub]"
tts = loom.Model.from_pretrained("loom-ai-org/pocket-tts-loom", "pocket-tts-q8_0_pc.gguf")
tts.text2speech.infer("Hello from a Raspberry Pi!").save("hello.wav")
🍓 A $20 computer
Let me start with the thing that still makes me smile. The Raspberry Pi Zero W has a single 1 GHz ARM11 core and 512 MB of RAM, and it sells for around $20 today ($10 at launch) (Raspberry Pi).
On that board, loom runs a wake-word front end, voice activity detection, a speech recogniser and a few tiny TTS voices faster than real time. The board also has a GPU, a VideoCore IV with 12 small QPU cores, that nobody uses for neural networks. loom has its own ggml backend for it (ggml-vc4), which makes every one of these models faster, up to 3.4x: Citrinet transcribes 11 s of speech in 3.4 s, and Piper's VITS voice drops from 19.4 s to 5.7 s.
Real-time factor: compute time divided by audio length, so under 1.0 is faster than real time. Protocol in BENCHMARKS.md.
Every stage of an offline voice pipeline (wake word, voice activity, recognition, speech) has a model that runs faster than real time on a board that fits in an Altoids tin, with no server anywhere. That's the reason this project exists.
🤔 Why a new engine?
Most of the progress in model inference has gone into one direction: fitting bigger models into GPU memory. Quantization formats, paged KV caches, offloading, speculative decoding: brilliant work, and it mostly assumes a decent GPU. That makes sense, because most of the money in AI is in the application layer, building business products on top of large hosted models.
Low-end devices get much less attention. Decentralized inference, portable gadgets and IoT still happen in niches, and the default "smart" device today is a microphone with a network connection. In March 2025, Amazon even removed the option to process Alexa requests locally on the Echo devices that supported it (TechCrunch, The Register).
There's a lot of value left on the table: devices that work without a network, don't ship your voice anywhere, run on a battery and cost a few dollars. For that you need an engine whose smallest target is a first-class citizen.
🧰 What's out there
There are good engines for small devices already, and they've done a lot for the field.
ONNX Runtime is the de facto standard: flexible, well maintained, and pretty decent for most use cases. But:
- It stops above the lowest end. Its PyPI wheels cover x86-64 and 64-bit ARM only (PyPI), so on a Pi Zero you're down to community builds, and projects built on it hit that wall (Piper).
- The GPU story depends on the platform. CUDA, DirectML, CoreML (preview) and WebGPU providers, but no native Vulkan or Metal one (execution providers).
- Exporting takes care, and sometimes doesn't work at all. The classic exporter traces the model once, so loops get unrolled and data-dependent behaviour is frozen (PyTorch docs). Decoders, ODE solvers and streaming state need careful wrapping, and some models won't export cleanly.
LiteRT (formerly TensorFlow Lite, renamed in 2024) is, in my experience, the best performer of the bunch, but:
- A model has to be remapped into its FlatBuffer format (overview), which isn't a general process. Generative PyTorch models should be re-authored with Google's building blocks first (Generative API).
- Memory layout is fixed when you convert. Prefill and KV-cache lengths are export-time flags
(
--cache_length=1280) (guide), which limits how caches and buffers are handled at run time. - Google's tooling doesn't reach every platform. No 32-bit ARM wheels either (PyPI). LiteRT for Microcontrollers exists, but with a limited subset of operations, far from today's speech models.
ggml is the other half of the story: the open-source, community-driven tensor library behind llama.cpp and whisper.cpp. Small, no dependencies, every CPU I've tried, Vulkan, CUDA, Metal and more, and moving fast. Its team joined Hugging Face in February 2026. llama.cpp showed what a focused engine on ggml can do for local LLMs. loom.cpp pushes ggml further down, to the boards the LLM world ignores, and across to speech and audio.
🧩 Models as data
This is the part I'm proudest of, and what sets loom apart from other ggml engines.
In llama.cpp, every architecture is C++ inside the library: you write its graph as a C++ struct
(HOWTO), and
src/models/ has over a hundred files, one per architecture
(src/models). The speech engines follow suit:
CrispASR has per-model runtimes in src/, "+ ~65 more"
(architecture), and
audio.cpp ports each model in C++
(CONTRIBUTING). It works and allows
hand-tuning, but the library grows with every model, and every architecture is a C++ change and a release.
loom turns that around. A loom GGUF carries everything specific to a model:
- the weights;
- the compute graphs, as JSON topologies of ggml-level ops;
- a driver script in Lua that calls them (an encoder once, a decoder in a loop, an ODE solver for N steps, a vocoder at the end);
- the tokenizer, voices and chat template, where the model has them.
The engine is a graph builder, a primitive registry and an embedded LuaJIT. It builds the file's graphs with ggml at run time and hands control to the file's driver (how it works).
Inside the published Citrinet-256 file (13 MB), the main graph is 1,200 nodes like this one:
{"op": "MUL_MAT", "inputs": ["x_13_mm_y_cont", "ctc.const_4"], "outputs": ["x_13"]}
and this is its driver's infer, verbatim: run the acoustic model, take the best token per frame, collapse
CTC repeats and blanks.
function infer(inputs)
local _waveform = inputs.waveform
loom.run_subgraph_and_retain('ctc', {n_samples = #_waveform, n_past = 0}, {waveform = _waveform, length = inputs.length})
local _ctc_frames = loom.argmax_rows('ctc')
local _ctc_out = {}
local _ctc_prev = 256
for _ctc_i = 1, #_ctc_frames do
local _ctc_id = _ctc_frames[_ctc_i]
if ((_ctc_id ~= _ctc_prev) and (_ctc_id ~= 256)) then
table.insert(_ctc_out, _ctc_id)
end
_ctc_prev = _ctc_id
end
return _ctc_out
end
Whisper's decode loop, Pocket TTS's latent loop, CosyVoice3's flow matching and Parakeet's transducer are
written the same way, in their own files. Why not control-flow ops in the graph, like ONNX and TFLite?
While/If ops put a compiler-shaped problem in the runtime and still can't express arbitrary host math. A
tiny JIT with a direct FFI to the engine can, at almost no cost in size.
What this buys:
- A lean engine. The
loom-py-rtwheel is 3.1 MB on Apple Silicon, 5.8 MB on ARM64 Linux and 2.4 MB for the Pi Zero (PyPI), and adding models doesn't grow it. - A new architecture is an export, not an engine release. loom-exporter traces the PyTorch model, lowers it to loom's primitives and writes the file.
- Every model gets every platform. x86-64, ARM64, ARMv6, Apple Silicon, Windows and the browser, on the CPU or on Vulkan, CUDA, Metal, WebGPU or the Pi Zero's GPU.
- A model describes itself: its task, inputs, voices and languages, so apps never recognise models by name.
What is in the engine is per-task machinery written once for everyone: tokenizers, the decode loop with each checkpoint's stop tokens and sampling defaults, chat templates, long-form ASR windowing, KV caches. That covers transducer, CTC and encoder-decoder ASR, autoregressive and flow-matching TTS, codec LMs, VITS, VAD, speaker and language ID, music and small chat models: 77 repos, and no model's network or decode loop compiled into the engine.
⚡ Performance
Lean and flexible would mean little if it were slow. On a Raspberry Pi 4, I ran loom and onnxruntime with the same precision, threads, inputs and output length. A bar past the dashed line means loom is faster:
At int8, loom is faster on all eight models, from 1.17x (whisper-small) to 9.3x (Citrinet). At full precision
it's ahead on six, level on whisper and behind on Citrinet. Much of that comes from kernels written for these
boards: a per-channel int8 format (Q8_0_PC) with GEMMs tuned for the Pi 4's Cortex-A72, and kernels for the
Pi Zero's ARM11. Protocol, onnxruntime build and checksums are in
BENCHMARKS.md.
It holds on cheap x86 too. On a fanless Windows mini PC with a Celeron N4100 (no AVX), loom transcribed faster than onnxruntime on both recognisers I tried, at the same accuracy: Zipformer 1.97x at F32, Citrinet 9.5x at int8.
🚀 Try it
pip install "loom-py-rt[hub]"
Every model answers through a "door" named for what it does: speech2text, text2speech, text2text,
speech2class, speech2embeddings, text2class, text2codes, codes2speech. From the model cards:
Live speech recognition, the transcript growing as audio arrives:
import loom
model = loom.Model.from_pretrained("loom-ai-org/citrinet-256-ls-loom", "citrinet-256-ls-f32.gguf")
print(model.speech2text.infer(audio).text) # audio: mono float samples at 16 kHz
stream = model.speech2text.stream()
for start in range(0, len(audio), 16000): # a second at a time
update = stream.push(audio[start:start + 16000])
if update.delta:
print(f"{update.seconds:5.1f} s {update.text}")
print(stream.finish().text)
Text to speech with the front end in the file: kale-tts-1-tiny reads numbers, dates and money with its own text front end, running inside the engine. No phonemizer needed:
model = loom.Model.from_pretrained("loom-ai-org/kale-tts-1-tiny-loom", "kale-tts-1-tiny-f32.gguf")
model.text2speech.infer("It is 9:30 on March 3, and it costs $4.50.", voice="kenzie").save("numbers.wav")
A small chat model:
lm = loom.Model.from_pretrained("loom-ai-org/gemma-3-270m-it-loom")
print(lm.text2text.chat("What is the capital of France?", temperature=0.0))
# 'The capital of France is Paris.'
On a Pi Zero, install the ARMv6 wheel from the release page (PyPI doesn't accept ARMv6 wheels) and the same code runs:
pip install https://github.com/loom-ai-org/loom-py/releases/latest/download/loom_py_rt-1.0.0-cp311-cp311-linux_armv6l.whl
No Python? There's a C++ CLI and a WebAssembly build for the browser (web/).
📦 Small boxes
There's something deeply satisfying about hearing a $20 board say "hello world" in a natural voice, or watching it transcribe you with no network cable plugged in. And it changes what you can build:
- Offline voice interfaces for appliances, toys and tools, where the voice never leaves the device.
- Accessibility devices (reading aloud, live captions) cheap enough to give away.
- Sensors that listen: a VAD or wake word on a battery-powered board, waking something bigger only when it matters.
- Classrooms, field stations and bad connectivity, where "call an API" isn't an option.
- Old hardware, the Pi 1s and Zeros in drawers everywhere, getting a second life.
🔭 What's next
loom 1.0.0 is out. Here's where I want it to go:
- More models, from more people. A new architecture is an export, so the exporter is where the community can have the most impact. Have a model you'd love on a small board? Tell me.
- Microcontrollers. The next step down is chips like Espressif's ESP32-S3 (two 240 MHz Xtensa LX7 cores with vector instructions, 512 KB of SRAM plus PSRAM) and XMOS's xcore.ai XU316 (16 logical cores, 1 MB of SRAM, vector units, built for voice). No Linux, memory in kilobytes: the engine and the file format will have to get leaner still. The models fit: sanoTTS already speaks on an ESP32-S3 with its own hand-written int8 engine, about 5x faster than real time (BOARDS.md), and loom runs those same voices on the Pi Zero today. The goal is to get there with the general engine and the same GGUF files, starting with the smallest models on the Hub: a 0.5 MB VAD, a 0.6 MB TTS and a 1.2 MB wake-word front end.
- Stranger hardware. The Pi Zero's GPU showed how much is left in hardware nobody targets. NPUs and other accelerators ggml can reach are next.
- Faster on every board, and Windows wheels on PyPI (they're on the release page today).
🔗 Links
- Engine: loom.cpp (MIT) · Python: loom-py · Exporter: loom-exporter · Models: huggingface.co/loom-ai-org
Each model keeps the licence of the checkpoint it was exported from; every model card says which. Every claim in this post links to its source where it's made.