A Raspberry Pi 4 8GB can run Gemma 3 4B at q4_K_M, but only at about 1.3–1.5 tok/s. That estimate scales from the Pi 400's measured 1.60 tok/s on a 2.0 GB 3B model. A Ryzen 5 2600 should manage about 10–12 tok/s, scaled from its measured 38.45 tok/s on Llama 3.2 1B. If a person reads the replies, you need the desktop.
Both of these machines are cheap to own. One is a credit-card-sized board that sips power. The other is a six-core AM4 chip from 2018 that turns up constantly on the used market. People shopping for an always-on home assistant end up looking at exactly these two: something that answers Home Assistant intents, summarizes notifications, drafts replies and never gets switched off.
Gemma 3 4B is the model that makes this comparison interesting. It's small enough that the Pi 4 8GB can load it without swapping. It's also good enough that you'd actually want to talk to it. Google's Gemma 3 model card lists a 128K-token context window and image input for the 4B size. The only real question is speed. Speed here comes from memory bandwidth, and on that measure the two boxes are more than ten times apart.
One note before the numbers. As of September 2026, nobody has published a verified Gemma 3 4B llama-bench run on either a Pi 4 or a Ryzen 5 2600. Every Gemma figure below is an estimate from the closest measured run on the same silicon, and each table says which rows were measured and which were estimated. Expect the estimates to be right to within about 20%, not to the decimal place.
Key takeaways
- Generation: ~1.3–1.5 tok/s on the Pi 4 vs ~10–12 tok/s on the Ryzen 5 2600 for Gemma 3 4B q4_K_M (2.49 GB file). That's roughly an 8× gap.
- Prefill is worse: ~2 tok/s vs ~30–35 tok/s. On the Pi, a 2,000-token prompt takes about 16 minutes before the first word appears. The 2600 takes about a minute.
- Memory fits on both. q4_K_M plus a 4K context needs about 3.2 GB. The Pi has about 7.6 GB free after boot (Geerling, sbc-reviews #110).
- Idle power: 1.6–2.7 W for the Pi (sbc-reviews #4, #110) vs roughly 35–50 W for a 2600 desktop. That's about $0.40 a month against $4.70–6.70 at 18.34¢/kWh.
- A used GTX 1050 Ti in the 2600 box raises Gemma 3 4B to an estimated 25–29 tok/s, with prefill around 300 tok/s.
What does Gemma 3 4B actually need?
Gemma 3 4B has 34 transformer layers, 4 key/value heads of 256 dimensions, and a 262K-token vocabulary whose embedding matrix is shared with the output layer (config.json). That shared matrix is why the 4B model is slightly bigger than its name suggests: the embedding alone is about 0.67 billion parameters, and the output layer reads all of them for every token.
The file sizes below come from Unsloth's Gemma 3 4B GGUF repository. No public perplexity sweep exists for Gemma 3 4B, so the quality column uses llama.cpp's own Llama 3 8B scoreboard as a proxy: the increase in perplexity over f16 at each quantization level, without an importance matrix. Small models tend to lose more than an 8B model does at the same bit-width, so read the column as a lower bound.
| Quant | File size | Working memory at 4K context (est.) | Quality loss (ΔPPL, Llama 3 8B proxy) | Fits Pi 4 8GB? |
|---|---|---|---|---|
| q2_K | 1.73 GB | ~2.4 GB | +56% (severe) | Yes; don't bother |
| q3_K_M | 2.10 GB | ~2.8 GB | +10.5% | Yes |
| q4_K_M | 2.49 GB | ~3.2 GB | +2.8% | Yes: the default choice |
| q5_K_M | 2.83 GB | ~3.5 GB | +0.9% | Yes |
| q6_K | 3.19 GB | ~3.9 GB | +0.35% | Yes |
| q8_0 | 4.13 GB | ~4.8 GB | +0.04% | Yes, slowly |
| BF16 | 7.77 GB | ~8.5 GB | baseline | No |
Working memory is the file plus an SWA-aware fp16 KV cache for 4K tokens (about 0.2 GB, calculated below) plus about 0.5 GB of runtime buffers. The Ollama gemma3:4b tag is a 3.3 GB download because it bundles the vision projector with a 4-bit text model. On a Pi, use a text-only GGUF unless you actually need image input.
q4_K_M is the right quant on both machines, and the reason is speed rather than quality. Generation speed is roughly inversely proportional to file size. Moving from q4_K_M to q8_0 costs about 40% of your tokens per second for a quality gain you'd struggle to notice in an assistant workload. On the Pi, that trade drops you below 1 tok/s.
Spec delta: Raspberry Pi 4 8GB vs Ryzen 5 2600
| Spec | Raspberry Pi 4 Model B 8GB | AMD Ryzen 5 2600 | Why it matters for Gemma 3 4B |
|---|---|---|---|
| Cores / threads | 4 / 4 Cortex-A72, up to 1.8 GHz (product brief) | 6 / 12 Zen+, 3.4 GHz base, 16 MB L3 (AMD) | Compute sets prefill speed |
| Memory type and bandwidth | LPDDR4, one 32-bit channel; 2.73–2.78 GB/s measured memcpy (#4, #110) | Dual-channel DDR4-2933 (AMD); 46.9 GB/s theoretical | Bandwidth sets generation speed |
| Usable RAM ceiling | 8 GB fixed; ~7.6 GB free after boot (#110) | Whatever the board holds; 16–32 GB is typical | Context length headroom |
| Idle / load power (wall) | 1.6 W / 5.0–7.2 W (#4) | 65 W CPU TDP; ~35–50 W idle / ~100–130 W load for the whole system (estimate) | Running cost for 24/7 duty |
| Street price (Sept 24, 2026) | $178.81 on the catalog listing; Geerling paid $147 in July 2026 | $265 new from a third-party seller (listing); much less used, plus board, RAM, PSU and case | Total cost of the box |
The 2600's bandwidth is a theoretical figure: two channels × 8 bytes × 2,933 MT/s, using the per-channel width from Wikipedia's DDR4 article. The Pi's figure is measured, and that's an important difference. Theoretical LPDDR4 bandwidth on the Pi is several times higher than its measured memcpy rate, and the measured rate is the one that predicts inference speed.
How fast is Gemma 3 4B on each box?
| Platform | Model / quant | Prefill tok/s | Generation tok/s | Basis |
|---|---|---|---|---|
| Pi 4 8GB (1.25 GHz edition) | TinyLlama 1.1B q4_K_M, 636 MiB | 8.70 (pp512) | 5.63 (tg128) | Measured, sbc-reviews #110 |
| Pi 400 (same BCM2711 SoC) | Llama 3.2 3B q4_K_M, 2.0 GB | not reported | 1.60 at 6 W | Measured, Geerling ai-benchmarks |
| Pi 4 8GB | Gemma 3 4B q4_K_M, 2.49 GB | ~1.8–2.3 | ~1.3–1.5 | Estimate |
| Pi 4 8GB | Gemma 3 4B q8_0, 4.13 GB | ~1.8–2.3 | ~0.8–0.9 | Estimate |
| Ryzen 5 2600 (system A) | Llama 3.2 1B q4_K_M | 109 | 38.45 | Measured, LocalScore #3667 |
| Ryzen 5 2600 (system B) | Llama 3.2 1B q4_K_M | 109 | 34.27 | Measured, LocalScore #3872 |
| Ryzen 5 2600 | Gemma 3 4B q4_K_M, 2.49 GB | ~30–35 | ~10–12 | Estimate |
| Ryzen 5 2600 | Gemma 3 4B q8_0, 4.13 GB | ~30–35 | ~6.5–7.5 | Estimate |
How the estimates were made. For generation, the measured runs imply an effective read rate: about 3.2 GB/s on the BCM2711 (1.60 tok/s × 2.0 GB) and 28–31 GB/s on the 2600 (38.45 tok/s × 0.81 GB). Gemma 3 4B reads its whole 2.49 GB file once per token, so divide each rate by 2.49 GB. For prefill, which is compute-bound, scale the measured rate by parameter count. Gemma 3 4B does about 3.1× the per-token work of Llama 3.2 1B and about 3.8× that of TinyLlama.
The ratio holds at every quant: the 2600 generates about 8× faster and prefills about 15× faster. llama.cpp's Apple Silicon performance thread shows the same effect across one chip family: generation rises almost in step with memory bandwidth from one M-series part to the next. There, only the bandwidth changes. Here, the bandwidth changes by more than 10×.
Why memory bandwidth decides this, not core count
To produce one token, the model reads every weight once. At q4_K_M that's 2.49 GB per token, so a machine's generation ceiling is its usable memory bandwidth divided by 2.49 GB. Core count barely enters into it. The llama.cpp developer Johannes Gäßler measured that "just 5 threads are enough to fully utilize the memory bandwidth provided by dual channel memory" on a desktop Ryzen. More cores just wait on RAM.
The Pi 4's memory is a single 32-bit LPDDR4 channel, and in practice it delivers about 2.8 GB/s of copy throughput. The Ryzen 5 2600 reads from two 64-bit DDR4 channels. Even at the 60–65% efficiency llama.cpp typically gets on a desktop, that's around 28–31 GB/s. Everything else follows from those two numbers. Overclocking the Pi's CPU won't help much. Buying faster DDR4 for the 2600 will help a little, because the chip is rated for DDR4-2933 and each step in memory speed shows up in tokens per second.
It also explains why the Pi's number doesn't improve with a smaller quant as much as you'd hope. q3_K_M cuts the file by 16%, but dequantizing 3-bit blocks costs more compute per byte. On four A72 cores, that compute starts to matter.
Prefill vs generation: why the Pi feels slower than its tok/s number suggests
A generation rate of 1.4 tok/s already sounds slow. The prefill rate is the real problem. Before the first output token, the model has to process every input token: your system prompt, the conversation history, any retrieved documents. That pass is compute-bound, and four Cortex-A72 cores manage roughly 2 tokens per second of it on a 4B model.
| Prompt length | Pi 4 8GB (est.) | Ryzen 5 2600 (est.) | + GTX 1050 Ti 4GB (est.) |
|---|---|---|---|
| 200 tokens (a short question) | ~1.5 min | ~6 s | <1 s |
| 1,000 tokens (system prompt + history) | ~7.5 min | ~30 s | ~3 s |
| 2,000 tokens (a pasted email thread) | ~16 min | ~1 min | ~7 s |
| 4,000 tokens (a retrieved document) | ~37 min | ~2.4 min | ~14 s |
The Pi's prefill also slows as the prompt gets longer. TinyLlama fell from 8.70 tok/s at 512 tokens to 6.82 at 4,096 in Geerling's run. A 2,000-token prompt is ordinary for any assistant with a real system prompt and a few turns of memory, and on the Pi it becomes a coffee break. llama-server's prompt cache helps, because a stable system prompt is only processed once. Each new turn still pays for its own tokens, though, and at 2 tok/s that adds up fast.
Context length: what 4K, 16K and 32K of KV cache cost in RAM
Gemma 3 uses interleaved attention. Five of its 34 layers attend to the full context, and the other 29 look at only the last 1,024 tokens. At fp16, each layer stores 4 KiB of key/value data per token (2 × 4 heads × 256 dims × 2 bytes). llama.cpp has used a sliding-window-aware KV cache since May 2025, so the 29 local layers never hold more than their window.
| Context | Full cache (every layer, every token) | SWA-aware cache | Pi 4 8GB total with q4_K_M, full / SWA |
|---|---|---|---|
| 4K | 0.57 GB | 0.21 GB | ~3.6 GB / ~3.2 GB |
| 16K | 2.28 GB | 0.46 GB | ~5.3 GB / ~3.5 GB |
| 32K | 4.56 GB | 0.79 GB | ~7.6 GB (nothing left) / ~3.8 GB |
| 128K | 18.3 GB | 2.81 GB | won't fit / ~5.8 GB |
The Pi runs out of memory at 32K, but only if your runtime stores the full cache: an older build, a runtime without SWA support, or llama.cpp run with --swa-full. With the SWA-aware cache, even 128K fits in 8 GB. The Ryzen box, with 16 GB or more, never gets close to either column.
In practice the Pi hits a time limit long before it hits a memory limit. At about 1.8 tok/s of prefill, filling a 32K context takes roughly five hours. Set num_ctx (Ollama) or -c (llama.cpp) to 4K–8K on the Pi, and add -ctk q8_0 -ctv q8_0 if you want to halve the cache.
Power and running cost
This is the one category the Pi wins outright. sbc-reviews #4 measured a Pi 4 at 1.6 W idle and 5.0 W under stress-ng at the wall. The 1.25 GHz edition in #110 measured 2.7 W idle and 6.2 W under Geekbench. A Ryzen 5 2600 desktop with a B450 board, one SSD and an efficient PSU is a different class of machine. Our estimate is 35–50 W idle and 100–130 W under all-core inference load.
| Metric (September 2026) | Raspberry Pi 4 8GB | Ryzen 5 2600 desktop |
|---|---|---|
| Idle draw | 1.6–2.7 W (measured) | ~35–50 W (estimate) |
| Load draw during generation | ~6 W | ~100–130 W |
| Generation, Gemma 3 4B q4_K_M | ~1.4 tok/s | ~11 tok/s |
| Energy per generated token | ~4.3 J | ~10 J |
| 24/7 month, mostly idle (730 h) | ~2.2 kWh ≈ $0.40 | ~29 kWh ≈ $5.40 |
| 24/7 month, pinned at load | ~4.4 kWh ≈ $0.80 | ~84 kWh ≈ $15.40 |
Costs use the US average residential rate of 18.34¢/kWh from the EIA's Electric Power Monthly. The Pi also uses less energy per token, about 2.3× less. That sounds decisive until you run the numbers on a single reply. A 300-token answer costs a fraction of a cent on either box, but it takes about 3.5 minutes on the Pi and about 27 seconds on the Ryzen. What you pay the 2600 for is idle power, roughly $60 a year more than the Pi, and in return you get replies you can read while they stream.
The escape hatch: a GTX 1050 Ti in the Ryzen 5 2600 build
The Ryzen 5 2600 has no integrated graphics, so plenty of builds already have an old card in the x16 slot. If that card is an EVGA GeForce GTX 1050 Ti FTW 4GB, Gemma 3 4B fits on it. The card has 4 GB of GDDR5 at 112 GB/s (Wikipedia). In the llama.cpp CUDA thread, a 1050 Ti generated 19.06 tok/s on a 3.82 GB 7B q4_0 model, which is an effective 73 GB/s. Divided by 2.49 GB, that's an estimated 25–29 tok/s for Gemma 3 4B q4_K_M. LocalScore measured 1,013.6 tok/s of prefill on Llama 3.2 1B, which scales to roughly 300 tok/s on a 4B model.
What 4 GB buys you. The q4_K_M weights (2.49 GB), an 8K SWA cache (~0.3 GB) and the CUDA context all fit with -ngl 99. Prefill improves by roughly 10× over the CPU, and that's the biggest change in the whole article.
What it doesn't buy you. It won't hold q6_K or q8_0 with a useful context. The vision projector (0.85 GB) won't fit alongside the weights, so keep it on the CPU. And it gives you no path to 12B. There's also a software deadline to know about. The 580 driver branch is the last to support Pascal, and CUDA 13.0 dropped Pascal targets, so build llama.cpp against CUDA 12.x. Buy the card used: the new-stock listing in our catalog was $369 on September 24, 2026, which is far above what the card is worth.
Where the model library lives: SATA on the desktop vs USB 3.0 on the Pi
On the desktop, a Crucial BX500 1TB is rated up to 540 MB/s sequential read, so a 2.49 GB q4_K_M file loads in about 5 seconds. On the Pi, a Kingston A400 960GB in a USB 3.0 enclosure is limited by the bridge chip. Geerling measured a Kingston SSD behind an Inateck adapter at 299.65 MB/s on a Pi 4, which works out to about 8 seconds for the same file. The Pi's own 64 GB microSD read at 40.84 MB/s in #110, or about 61 seconds.
Load time is a one-time cost, as long as the model stays resident. llama.cpp memory-maps the GGUF, so after the first load the weights live in the page cache, and a restart reads them from RAM rather than disk. Ollama unloads idle models after five minutes by default, so an always-on assistant should set <code>keep_alive</code> to -1 to keep the model resident. Use the SSD on the Pi anyway, for a different reason: sustained writes from logs and swap wear out microSD cards, and a worn-out card is how a lot of always-on Pi deployments end.
Common pitfalls
- Running a 32-bit OS on the Pi. The 64-bit Raspberry Pi OS is required for llama.cpp's ARMv8 NEON paths. A 32-bit userland loses a large share of your already small throughput.
- Pulling the default Ollama tag on the Pi.
gemma3:4bincludes the vision projector. Use a text-only q4_K_M GGUF unless you need image input. - Leaving
num_ctxat a large value. On the Pi, every token of context you actually use costs about half a second of prefill. Size the context to what your assistant needs. - Running single-channel RAM on the 2600. One DIMM halves bandwidth and roughly halves generation speed. Two matched sticks in the right slots are worth more than a CPU upgrade.
- Skipping thermals on the Pi. Sustained inference keeps all four cores at 100%. Without a heatsink or case fan, the board throttles and the estimates above drop further.
Verdict matrix
| Get the Raspberry Pi 4 8GB if… | Get the Ryzen 5 2600 build if… | Get neither and save for 12 GB of VRAM if… |
|---|---|---|
| Nothing human waits on the output: overnight summaries, batch tagging, scheduled digests | A person reads the replies and 10+ tok/s is your bar | Your prompts routinely pass 2,000 tokens (RAG, long histories) |
| Prompts stay under ~300 tokens | You want 16K+ context in practice, not just on paper | You expect to move to 8B–14B models within a year |
| Idle power and silence are hard requirements | You already own the AM4 parts, or can buy them used cheaply | You want vision input and a 4B model resident at the same time |
| You'd accept dropping to Gemma 3 1B for interactive use | You'll add a used GTX 1050 Ti for faster prefill | You want time-to-first-token under a second |
The recommended pick
The Ryzen 5 2600 build wins for Gemma 3 4B. It generates about 8× faster and prefills about 15× faster, and that's the difference between an assistant and a batch job. It's the wrong pick for anyone whose main constraint is the power bill or fan noise. In that case, keep the Pi and run a smaller model on it: our Pi 4 vs Ryzen 5 5600X Gemma 3 1B comparison shows 1B-class models at about 5 tok/s, which is usable. If you already have both, use them together: the Pi for always-on light duty, and the 2600 (ideally with a GPU) woken over the network for real work.
Live price comparison
Prices on both boards move every week. The live head-to-head at /compare/B0899VXM8F-vs-B07B41WS48 pulls current Amazon and eBay pricing for the Raspberry Pi 4 Model B 8GB and the AMD Ryzen 5 2600. The spec pages are at Ryzen 5 2600 benchmarks and GTX 1050 Ti benchmarks. If you decide to skip both, the MSI RTX 3060 12GB is the usual next step.
Related guides
- Raspberry Pi 4 8GB local LLM tokens per second (2026)
- Ryzen 5 5600G for local LLMs: CPU and iGPU inference
- Best budget GPU for local LLMs (2026)
- GTX 1050 Ti 4GB vs Ryzen 5 2600 CPU for Gemma 3 1B
- RTX 3060 12GB vs GTX 1050 Ti 4GB for Gemma 3 4B
Citations and sources
All accessed September 24, 2026.
- Google — Gemma 3 model card: context window, modalities
- Unsloth — Gemma 3 4B GGUF files and config.json: quant sizes, layer and head counts, sliding window
- Ollama — gemma3:4b: default tag size
- llama.cpp — perplexity README (Llama 3 8B scoreboard): quantization quality proxy
- llama.cpp — Apple Silicon performance discussion #4167: bandwidth vs generation speed
- llama.cpp — CUDA performance discussion #15013: GTX 1050 Ti run
- llama.cpp — SWA KV cache PR #13194
- Johannes Gäßler — llama.cpp performance notes
- Raspberry Pi 4 product brief (PDF)
- Jeff Geerling — sbc-reviews #4, Raspberry Pi 4 and #110, Pi 4 1.25 GHz edition: power, memcpy, llama-bench
- Jeff Geerling — ai-benchmarks: Pi 400 Llama 3.2 3B run
- Jeff Geerling — raspberry-pi-dramble #183: Pi 4 USB 3.0 storage
- LocalScore — Ryzen 5 2600 #3667, #3872, GTX 1050 Ti #1009
- AMD — Ryzen 5 2600 specifications
- Wikipedia — DDR4 SDRAM and GeForce 10 series
- Phoronix — NVIDIA 580 is the last driver for Pascal; NVIDIA — CUDA 13.0 release notes
- Crucial — BX500 1TB
- EIA — Electric Power Monthly, Table 5.6.A
- Ollama — FAQ (keep_alive)
