SBC / Embedded

Can Raspberry Pi 5 (4 GB) run Gemma 4?

4 GB memory profile for local Gemma 4 testing. The checker below ranks Gemma 4 E2B, E4B, 12B, 26B A4B, and 31B specifically for Raspberry Pi 5 (4 GB).

GPU
VRAM4 GB est.
BW~32 GB/s
RAM4 GB
CORES--
WebGPU
0RUNS GREAT
0RUNS WELL
0DECENT
0TIGHT FIT
0BARELY RUNS
7TOO HEAVY
Gemma 4 only
Gemma 4 E2BbestQ4_K_M

Phones, tablets, old laptops, and the fastest local proof.

Memory: 3.1 GBUse: 78%Speed: ~7 tok/sScore: 0/100
TOO HEAVY
0/100

Better phones, Apple silicon laptops, and mainstream desktops.

Memory: 4.6 GBUse: 115%Speed: ~5 tok/sScore: 0/100
TOO HEAVY
0/100

16GB+ unified-memory Macs and desktops with room for context.

Memory: 7.1 GBUse: 178%Speed: ~3 tok/sScore: 0/100
TOO HEAVY
0/100

The instruct 12B when you want chat, vision, and a 256K window on 16GB+ machines.

Memory: 7.1 GBUse: 178%Speed: ~3 tok/sScore: 0/100
TOO HEAVY
0/100
Gemma 4 26B-A4B IT4B activeQ4_K_M

Strong desktop GPUs and disciplined 24GB+ Apple silicon setups.

Memory: 15.8 GBUse: 395%Speed: ~1 tok/sScore: 0/100
TOO HEAVY
0/100

Gemma-family MoE when you want the newer diffusion decode path and multimodal prompts.

Memory: 13.8 GBUse: 345%Speed: ~2 tok/sScore: 0/100
TOO HEAVY
0/100

High-end workstations where local quality matters more than convenience.

Memory: 19 GBUse: 475%Speed: ~1 tok/sScore: 0/100
TOO HEAVY
0/100

Full Model Directory

Explore 130+ Other Open-Weight Models on This Hardware

Compare Llama 3.3, Qwen 3, DeepSeek-R1, Mistral, and Phi on Raspberry Pi 5 (4 GB), or run a side-by-side GPU and Apple Silicon benchmark comparison.

Hardware Memory Analysis

Usable Memory Pool & Bandwidth Profile for Raspberry Pi 5 (4 GB)

Raspberry Pi 5 (4 GB) runs inference directly on ARM CPU cores backed by shared LPDDR system memory (4 GB profile, ~32 GB/s bandwidth). Without a high-bandwidth discrete GPU, token speed scales closely with raw LPDDR bandwidth and keeping total memory below ~70% (2.8 GB) prevents Linux swap thrashing.

Practical Model Budget

2.8 GB

Memory Bandwidth

~32 GB/s

Recommended Checkpoint

Gemma 4 E2B (Q4_K_M)

Gemma 4 Checkpoint Compatibility Matrix on Raspberry Pi 5 (4 GB)

Evaluated at Q4_K_M baseline weights plus 0.5 GB baseline runtime overhead against Raspberry Pi 5 (4 GB)'s 2.8 GB usable budget. Leave at least 1.5–4 GB spare headroom for multi-turn KV cache expansion.

ModelQ4_K_M MemoryEst. SpeedGradePractical Headroom Verdict
Gemma 4 E2B3.1 GB--Too heavyExceeds on-device memory budget
Gemma 4 E4B4.6 GB--Too heavyExceeds on-device memory budget
Gemma 4 12B7.1 GB--Too heavyExceeds on-device memory budget
Gemma 4 12B IT7.1 GB--Too heavyExceeds on-device memory budget
Gemma 4 26B-A4B IT15.8 GB--Too heavyExceeds on-device memory budget
DiffusionGemma 26B-A4B IT13.8 GB--Too heavyExceeds on-device memory budget
Gemma 4 31B19 GB--Too heavyExceeds on-device memory budget

Single-Board Computer CPU Threading Guide for Raspberry Pi 5 (4 GB)

  • Run headless `llama-cli` or `llama-server` compiled natively for ARM64 (`-mcpu=native`) with fast UHS-I/NVMe storage instead of slow microSD cards.
  • Pin `-t` strictly to physical performance CPU cores and use Q4_K_M or IQ4_XS builds of E2B / small 1B–3B models.
  • Use active heatsink/fan cooling so prolonged token generation does not throttle CPU frequencies.

Frequently Asked Questions for Raspberry Pi 5 (4 GB)

What is the best Gemma 4 model to run on Raspberry Pi 5 (4 GB)?
Based on Raspberry Pi 5 (4 GB)'s 2.8 GB practical memory budget and ~32 GB/s bandwidth, Gemma 4 E2B (Q4_K_M, 3.1 GB) is the strongest comfortable fit (~7 tok/s).
Can Raspberry Pi 5 (4 GB) run Gemma 4 26B-A4B MoE locally?
No. Gemma 4 26B-A4B requires ~15.8 GB at Q4_K_M, exceeding Raspberry Pi 5 (4 GB)'s 2.8 GB on-device memory budget. Use Gemma 4 E2B instead.
How fast does Raspberry Pi 5 (4 GB) generate tokens with Gemma 4?
With ~32 GB/s memory bandwidth, Gemma 4 E2B at Q4_K_M averages roughly 7 tokens per second when fully resident without swap or PCIe spillover.
Which quantization format works best on Raspberry Pi 5 (4 GB)?
Start with Q4_K_M (~4.5 bits/weight) to keep memory headroom free for 8K+ context windows. Step up to Q6_K or Q8_0 only if Q4_K_M consumes well under 60% of available VRAM or unified memory.