Introduction
Last week I finally got around to testing how small language models perform on actual edge hardware. I've been reading about edge AI deployment for months, but nothing replaces hands-on experience with the real constraints. This post documents what I learned running Phi-3.5-mini-instruct quantized to 4-bit on a Raspberry Pi 5 with 8 GB of RAM, and what I wish I'd known before starting.
For the full technical guide with memory calculations and deployment scripts, see Edge AI Deployment: Running LLMs on Resource-Constrained Devices in 2026.
The Hardware Reality Check
The Raspberry Pi 5 with 8 GB is the most capable Pi yet, but it's still a $80 single-board computer. The Broadcom BCM2712 quad-core Cortex-A76 at 2.4 GHz doesn't have AVX-512, so llama.cpp falls back to AVX2 and NEON paths. That's fine for small models, but it means no fancy tensor core acceleration.
Memory is the real bottleneck. After the OS and basic services, I had roughly 6.5 GB available. A 3B parameter model at 4-bit quantization takes about 1.9 GB for weights. The KV cache for a 4K context adds another 300 MB. That leaves maybe 4 GB headroom—enough for the application, but tight if you're running anything else.
I tried loading a 7B model quantized to 4-bit (about 4 GB for weights). It loaded, but generation was painfully slow—under 1 token per second—and the system started swapping. Not a usable experience.
Model Selection Lessons
I tested three models on this hardware:
Phi-3.5-mini-instruct (3.8B, Q4_K_M): This was the sweet spot. 4-5 tokens per second on the Pi 5, coherent responses, decent instruction following. The model fits comfortably in memory with room for a reasonable context window.
Qwen2.5-1.5B-Instruct (Q4_K_M): Faster at 8-10 tokens per second, but noticeably less capable on reasoning tasks. Good for simple classification or summarization, not for multi-step problems.
Llama-3.2-1B-Instruct (Q4_K_M): Similar speed to Qwen, comparable capability. Slightly better on code tasks in my quick tests.
The takeaway: 3B is the floor for "actually useful" on this hardware class. 1B models are fast but too limited for anything beyond toy tasks.
Quantization Choices Matter More Than I Expected
I initially grabbed the first Q4_K_M file I found on Hugging Face. Then I compared Q4_K_M vs Q4_K_S vs Q5_K_M vs Q8_0.
Q4_K_S (smaller 4-bit variant) was marginally faster but produced noticeably more hallucinations on factual questions. Q5_K_M was slower with no perceptible quality gain for general chat. Q8_0 was too large—over 3.5 GB for weights alone—leaving almost no room for context.
Q4_K_M remains the best balance for this hardware. The "K" quantizations (k-means clustering for outlier weights) genuinely preserve quality better than the older Q4_0 linear quantization.
Practical Deployment Gotchas
Context Window vs. Memory
The default context in many llama.cpp examples is 8192 or 32768. On 8 GB RAM, a 32K context with a 3B model will OOM. I settled on 2048 tokens for interactive use, 4096 for batch processing where I can control the input length. If you need long context on edge hardware, you need more RAM or a smaller model.
Thread Count Tuning
The Pi 5 has 4 cores. Setting -t 4 seems obvious, but I found -t 3 sometimes faster because it leaves one core for the OS and memory management. The difference was small (10-15%), but measurable. Test your specific workload.
Thermal Throttling Is Real
The Pi 5 in the official case with no fan hits thermal throttle (80°C) after about 10 minutes of sustained generation. A $5 fan keeps it under 60°C and maintains full speed indefinitely. If you're deploying headless, budget for active cooling.
The Server Mode Is Production-Ready
I was skeptical of llama-server for anything beyond testing. It's not. The OpenAI-compatible endpoint works well, handles concurrent requests with a queue, and exposes metrics. I ran it behind nginx with basic auth for a week serving a small internal tool—zero issues.
Power Consumption Profile
Running Phi-3.5-mini continuously draws about 6-7 watts on the Pi 5 under load. That's not trivial for battery-powered deployments. A 10,000 mAh USB power bank lasts roughly 6-7 hours of sustained inference. For intermittent use (a few queries per hour), you can stretch that to days. Plan your power budget accordingly.
Storage Speed Matters
The model loads from the microSD card (or NVMe if you have the HAT). A slow card adds 10-15 seconds to model load time. A decent A2-rated card or NVMe cuts that to 2-3 seconds. For server mode where the model stays loaded, this matters less, but for CLI invocation it's noticeable.
What I'd Do Differently Next Time
-
Start with the memory budget, not the model wishlist. Calculate: available RAM - OS overhead = model budget. Then pick the largest model that fits with your required context.
-
Benchmark before committing. Run a 50-prompt eval on your actual hardware with your actual quantization. Synthetic benchmarks don't capture thermal behavior or memory pressure.
-
Plan for model updates. The model file is 2 GB. Updating it over a flaky cellular connection on a field device is painful. Design for delta updates or have a rollback strategy.
-
Don't ignore the prompt template. Phi-3.5 uses a specific chat format. Using the wrong template gives garbled output. The GGUF metadata usually includes the correct template—use it.
When Edge Makes Sense (and When It Doesn't)
Edge inference shines for: privacy-sensitive data, offline operation, predictable latency, zero per-token cost at scale.
It struggles with: large models, high concurrent throughput, tasks requiring frontier-model reasoning, rapid iteration on model versions.
The hybrid approach—small local model for routing/classification/simple tasks, cloud fallback for complex reasoning—is where I see the most practical deployments heading.
Conclusion
Running LLMs on a Raspberry Pi 5 is genuinely practical in 2026, but only for the right models at the right quantization with the right expectations. Phi-3.5-mini at Q4_K_M with a 2K context gives you a usable local assistant. Don't try to run 7B models on 8 GB. Do budget for a fan.
The hardware will keep improving—Pi 6 will likely have more RAM and NEON V8.1 support. But the fundamental trade-off (model capability vs. device constraints) will remain. Understanding that trade-off is the real skill.
This post reflects personal experimentation on specific hardware. Your results will vary based on model choice, quantization, thermal solution, and workload. Always benchmark on your target deployment hardware.