Home / use case

Offline LLM on a Raspberry Pi 5 for classification and extraction

At a glance
Hardware
Raspberry Pi 5, 8 GB, 64-bit Raspberry Pi OS
Models & engines
llama.cpp built with NEON/dotprod (or Ollama for prototyping)
Phi-3 mini 3.8B at Q4_K_M (~2.3 GB)
Key gotcha
Memory, not compute, is the limit: the practical ceiling is ~4B at Q4

What they built

Stefano Noferi runs a quantised model on an 8 GB Raspberry Pi 5 with no network. The point isn't throughput. The text never crosses a network boundary, which removes data-transfer obligations by construction.

The Pi is treated as the place for the smallest model that solves a precise task: classify an email, extract fields, route a request or summarise a paragraph.

Setup

  • Raspberry Pi 5, 8 GB, 64-bit Raspberry Pi OS
  • llama.cpp built with NEON/dotprod (or Ollama for prototyping)
  • Phi-3 mini 3.8B at Q4_K_M (~2.3 GB)

Results & numbers

  • 1-2B models at Q4: tens of tokens/s
  • Phi-3 mini 3.8B Q4_K_M: ~4-6 tokens/s
  • 7-8B at Q4: under 2 tokens/s, not interactive
  • llama.cpp from source is ~10-20% faster than Ollama

Gotchas

  • Memory, not compute, is the limit: the practical ceiling is ~4B at Q4
  • Q4 quantization degrades quality; measure it on your task, especially for multi-step reasoning
  • Validate on real data, not published benchmarks
“Keeping inference on the device cuts the transfer at the root, not as a mitigation measure but as a physical fact.”— Stefano Noferi

Do it yourself

  1. Flash 64-bit Raspberry Pi OS on an 8 GB Pi 5
  2. Build llama.cpp natively (or install Ollama to prototype)
  3. Download Phi-3 mini Q4_K_M GGUF
  4. Design narrow prompts (classify, extract, route) rather than chat
  5. Validate accuracy on your own data
Source: Stefano Noferi · Added 2026-10-18. This write-up summarizes the original source; see it for full details.

Similar setups

Link Séance: a local Gemma 3 writes grounded epitaphs for the dead links in your bookmarks

Abdul AmberNeel built a command-line tool that checks every link in a bookmarks file, finds the last living Wayback Machine snapshot of dead ones, and has a local Gemma 3 write a two-sentence epitaph only from what the archive kept.

Abdul AmberNeel (DEV Community) · 2026-10-31

Running NVIDIA's looped Dory 4B on a CPU homelab with llama.cpp and an Ollama wrapper

Big Iron built NVIDIA's llama.cpp fork on a no-GPU Debian VM, measured Dory 1.0 4B at each loop count against Qwen3.5-4B, and got it running inside Ollama 0.40 through a wrapper around Ollama's internal llama-server.

Big Iron · 2026-11-10

A copy-paste path to a local OpenAI-compatible LLM endpoint with LM Studio, Ollama, or llama.cpp

Mikalai Karytka’s Nov 2026 guide walks through installing LM Studio’s lms CLI (plus Ollama and llama.cpp equivalents), sizing RAM for a quantized model, serving an OpenAI-compatible API, and checking tool-calling before you build agents on top.

Mikalai Karytka (DEV.to) · 2026-11-05

Explaining Swiss administrative letters in plain Italian with a 1B Gemma on CPU

Damiano built a personal tool that explains Swiss administrative letters, like debt-collection payment orders, in plain Italian using a 1B Gemma on CPU through Ollama, with plain code extracting the deadline and amount so the model never has to.

Damiano (DEV Community) · 2026-10-22