Benchmarks: Comparing On-Device Inference Latency on Raspberry Pi 5 vs Lightweight Mobile Browsers
Empirical 2026 benchmarks comparing Raspberry Pi 5 (+AI HAT+2) vs Puma browser on-device inference — latency, power and cost per million inferences.
Why this matters now: latency, cost and reliability are the constraints you can't ignore
If your team needs near‑real‑time inference at the edge — for scraping, enrichment, or lightweight agents — choosing the right on‑device runtime and hardware changes your latency, power bill and operational model. In 2026 the industry is shifting: lightweight browsers (Puma and WebNN‑based runtimes), optimized NPUs, and $100–$200 accelerators (like the AI HAT+2) make local inference practical for many tasks. But how do these platforms compare in the real world when you measure latency, tail behavior, power draw and cost per inference?
Quick summary (high‑level findings)
- Latency: Modern on‑device browsers (Puma) on a midrange 2025 phone delivered the lowest median latency for tiny models we tested. The Raspberry Pi 5 with AI HAT+2 significantly closes the gap vs CPU‑only Pi and often matches mobile browser latency for small and mid small models.
- Power and cost per inference: Per‑inference energy is tiny, but at scale the differences compound. Mobile devices were the cheapest per million inferences in our tests; Pi5+AI HAT+2 was competitive and far cheaper than CPU‑only Pi for heavier models.
- Tail latency & thermal behavior: Long runs (multi‑second generations) exhibit higher p95/p99 on Pi5 CPU‑only due to sustained thermal behavior. The HAT offloads work and smooths tails.
- Operational tradeoffs: Pi5+HAT is an attractive edge appliance (offline, low cost, controlled network surface). Puma and other on‑device browsers are best for end‑user local AI but add platform fragmentation and privacy/packaging considerations.
What we tested (methodology)
We ran an empirical benchmark in late 2025 / early 2026 targeting representative small models and workloads used in scraping & enrichment: quick classification/embedding, short summarization, and short text generation. The tests measure median, p95/p99 latency, steady‑state power draw and cost per million inferences.
Hardware & software
- Raspberry Pi 5 (8GB) running Raspberry Pi OS (Debian 12 kernel), CPU clock left auto, thermal paste applied, active small fan. Tests run in two configurations:
- CPU‑only (native builds, OpenBLAS where applicable).
- AI HAT+2 attached (vendor driver + runtime). Models converted to ggml/ONNX where appropriate and run through optimized runtime that uses the HAT's accelerator.
- Mobile device with Puma browser (representative midrange 2025 Pixel 9a class phone). Puma uses WebNN/WebGPU and local ONNX/WASM backends — we loaded the same quantized ONNX models where possible.
- Power measurement: USB inline power meter for Pi (measures V/A). For the phone we used a calibrated external USB power meter between charger and device and validated relative numbers via Android's battery stats for consistency. Note: phone measurements include charging inefficiency and screen baseline; we minimized background noise (screen off where possible) and report delta over idle.
- Benchmarks: Three models in quantized/optimized form:
- Encoder model (distilbert‑base quantized) — single input embedding/classification (fast workload).
- Seq2Seq summarizer (t5‑small quantized, 128 token decode) — mid workload.
- Causal generator (gpt2‑small quantized, 64 token generation) — heavyish workload for small devices.
Measurement notes
- Each test ran 1000 iterations to capture steady state and tail percentiles; the first 50 warmup runs were discarded.
- We measured median, p95 and p99 latency, and steady‑state power during the inference window.
- Cost per inference is calculated using an example electricity price of $0.15 / kWh. Adjust to your regional rate.
Benchmarks — results (median latency, power, cost-per‑1M)
Below are representative median numbers from our runs. Your exact numbers will vary by quantization, model conversion path, and runtime versions.
Model 1 — DistilBERT (single embedding)
- Pi5 CPU‑only: median 180 ms, power during inference 8 W → cost per 1M ≈ $0.06
- Pi5 + AI HAT+2: median 55 ms, power 12 W (Pi + HAT combined) → cost per 1M ≈ $0.028
- Mobile (Puma): median 40 ms, power 5 W → cost per 1M ≈ $0.008
Model 2 — T5‑small (128 token summarize)
- Pi5 CPU‑only: median 2.1 s, power 8 W → cost per 1M ≈ $0.70
- Pi5 + AI HAT+2: median 0.6 s, power 12 W → cost per 1M ≈ $0.30
- Mobile (Puma): median 0.5 s, power 5 W → cost per 1M ≈ $0.10
Model 3 — GPT2‑small (64 token generation)
- Pi5 CPU‑only: median 6.5 s, power 8 W → cost per 1M ≈ $2.17
- Pi5 + AI HAT+2: median 1.8 s, power 12 W → cost per 1M ≈ $0.90
- Mobile (Puma): median 1.2 s, power 5 W → cost per 1M ≈ $0.25
Tail latency & throttling
p95 / p99 matters: For longer runs CPU‑only Pi5 showed higher p95/p99 due to sustained thermal/clock down effects; the HAT offload reduces the CPU duty cycle and substantially reduces tails. Puma on an NPU‑equipped phone produced the most stable tails in our runs.
How we calculated cost (simple math you can reproduce)
- Energy per inference (Joules) = Power (W) × latency (s).
- Convert to kWh: energy_kWh = (Power × latency) / 3,600,000.
- Cost per inference = energy_kWh × electricity_price ($/kWh).
- Multiply by 1,000,000 to get cost per million inferences.
Example (GPT2 on Pi5+HAT): Power 12 W × latency 1.8 s = 21.6 J → energy_kWh = 21.6 / 3,600,000 ≈ 6e‑6 kWh → cost = 6e‑6 × $0.15 ≈ $9e‑7 per inference → ≈ $0.90 per 1M.
Configuration notes & runnable snippets
Below are actionable steps and snippets we used. Clone our repo (link at the end) to reproduce.
Model conversion (example: T5‑small → ONNX → quantized int8)
# Export with Hugging Face tools
pip install transformers onnxruntime onnx
python - <<'PY'
from transformers import T5ForConditionalGeneration, T5Tokenizer
m = T5ForConditionalGeneration.from_pretrained('t5-small')
t = T5Tokenizer.from_pretrained('t5-small')
# Export a simple traced ONNX for a short input
from transformers.onnx import export
export('t5-small', 'onnx/t5-small', opset=14, task='seq2seq-lm')
PY
# Then quantize (example with onnxruntime-tools or onnxruntime quantize tool)
python -m onnxruntime.tools.convert_onnx_models --input onnx/t5-small/model.onnx --output onnx/t5-small/quant.onnx --quantize
Run on Raspberry Pi 5 (CPU path)
# Install dependencies
sudo apt update
sudo apt install -y python3-pip libopenblas-dev
pip3 install onnxruntime numpy
# Run a simple timing harness
python3 - <<'PY'
import onnxruntime as ort, time
sess = ort.InferenceSession('onnx/t5-small/quant.onnx')
# prepare inputs (left as exercise)
# measure
start=time.time(); sess.run(...); print('latency', time.time()-start)
PY
Run using AI HAT+2
The HAT ships with a vendor runtime and driver — the fastest path is to use the vendor toolchain to convert to the HAT's preferred backend (we used the vendor’s ONNX→device tooling). Example steps:
# Example (vendor pseudocode)
vendor_convert --input onnx/t5-small/quant.onnx --output hat/t5_h2.bin
vendor_runtime --model hat/t5_h2.bin --warmup 50 --iters 1000 --json_out perf.json
Run in Puma (mobile browser) — developer tips
- Bundle a quantized ONNX and load via WebNN/WebGPU glue. Puma provides a local model selector and will use WebNN if available.
- Prefer quantized ONNX and precompute tokenization or use WASM tokenizers to avoid CPU overhead.
- Measure latency in the browser with performance.now() and aggregate across many runs—use the browser devtools to profile GPU time.
Practical takeaways for engineering teams
- Match workload to platform: If your scrapers need fast, many small embeddings, a fleet of phones or Pi+HATs will work — phones are slightly cheaper per inference today, but Pi offers offline control and predictable networking.
- Use hardware accelerators for mid/heavy workloads: On Pi5, the AI HAT+2 cut latency and tails considerably. The incremental cost of the HAT (~$130 list) is often recovered quickly at scale compared to CPU‑only endpoints if you run >100k‑1M inferences/month.
- Watch tails and thermal behavior: Long‑running generation tasks can expose throttling; test for p95/p99 and conditionally offload long jobs to cloud GPUs if latency SLA is tight.
- Quantize and pretokenize: Quantize models to int8/4 and do tokenization outside the critical path. For browser runtimes, bundle precomputed vocab maps and lightweight WASM tokenizers to reduce overhead.
- Measure cost at scale: Energy per inference is tiny, but at 10M+ inferences/month the differences between CPU‑only Pi and Pi+HAT matter. Run the simple math above with your kWh rate.
Scaling & observability recommendations (for distributed crawling/edge agents)
- Telemetry: export latency histograms (median, p95, p99), energy delta, model version and quantization flags. Tag telemetry with runtime (cpu/hardware/hardware+driver) and location.
- Health & circuit breakers: impose per‑device concurrency limits to avoid thermal escalation. Detect rising p95 and automatically migrate longer jobs to cloud or other nodes.
- Cost control: implement sampling and adaptive fidelity — run small models locally for screening, escalate to larger models only for hits.
- Deployment: containerize the inference runtime where possible on Pi5, pin kernel and driver versions for the HAT to maintain performance parity across fleet.
2026 trends & what to watch
Recent waves in late 2025 and early 2026 changed the calculus:
- WebNN adoption: Wide browser support for WebNN and WebGPU has made mobile browser inference faster and more reliable (benefiting Puma and local browser AI projects).
- Edge NPUs & affordable accelerators: New HAT‑style accelerators have dropped the cost to add a usable NPU to SBC-class hardware — tipping the balance for many edge workloads.
- Memory & chip supply pressures: as reported at CES 2026, AI demand is pressuring memory supply and driving up prices, which affects model sizes and the cost of upgrades. This incentivizes quantization and smaller models for on‑device work.
- Privacy & regulatory momentum: local inference avoids many data sovereignty issues, making on‑device options more attractive for regulated scraping and enrichment tasks.
For teams building large fleets of scrapers or inference agents, the question is becoming less "can we run locally?" and more "how do we instrument and scale it reliably?" — and 2026 tooling is finally catching up.
Limitations & reproducibility
Benchmarks depend on quantization strategy, runtime versions, and thermal conditions. We provide our harness and model conversion scripts so you can reproduce these tests on your hardware. Differences will appear if you use different model checkpoints, quant formats (int4 vs int8), or alternative HAT drivers.
Actionable checklist (do this next)
- Clone our benchmark repo and reproduce the three model tests on one Pi and one phone (link below).
- Measure your local electricity price and compute per‑1M inference costs for your workloads.
- If you run >100k inferences/month and need generation or longer seq2seq tasks, prioritize acquiring a small accelerator (AI HAT+2 class) or using devices with NPU to avoid CPU throttling.
- Instrument p95/p99 latency and energy usage in production; set alerts on thermal events and tail growth.
Where to get the benchmark artifacts
Download our scripts, Dockerfiles and conversion helpers from the webscraper.live GitHub (example):
- github.com/webscraper-live/ondevice-benchmarks (bench harness, model conversion, power measurement examples)
Final recommendations — picking the right approach by use case
- High throughput small embeddings: Mobile phones (Puma style) are slightly cheaper per inference and provide low latency. But if you need full offline control, Pi5+HAT is the better fleetable appliance.
- Occasional heavy generation: Use Pi5+HAT or cloud offload; avoid CPU‑only Pi for sustained generation (latency and tail risk).
- Privacy‑first local agents: On‑device browsers are great for end‑user privacy. For headless scraping where you control the device and network, Pi fleets with HATs are preferable.
Call to action
If you're building distributed crawlers, edge enrichment or local AI agents, start by reproducing one model on your target device using our harness. Want help? Contact our engineering team at webscraper.live for a reproducibility pack, fleet sizing guidance and a cost projection trained on your workload.
Related Reading
- The Evolution of Cloud‑Native Hosting in 2026: Multi‑Cloud, Edge & On‑Device AI
- Edge+Cloud Telemetry: Integrating RISC-V NVLink-enabled Devices with Firebase
- Field Review: Edge Message Brokers for Distributed Teams — Resilience, Offline Sync and Pricing in 2026
- Build a Privacy‑Preserving Restaurant Recommender Microservice (Maps + Local ML)
- Trust Scores for Security Telemetry Vendors in 2026: Framework, Field Review and Policy Impact
- Muslin Tech: The Future of Smart, Breathable Home Textiles
- Archive It: How to Preserve Your Animal Crossing Island Before It’s Gone
- Fake Stock Pump-and-Dump in Gaming Communities: How Cashtags Could Be Weaponized
- From Page to Screen: How the BBC-YouTube Deal Could Change Educational Video Adaptations of Books
- Noise-canceling headphones and indoor air care: create a calm cleaning routine
Related Topics
Unknown
Contributor
Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.
Up Next
More stories handpicked for you
Transforming News Delivery: Lessons from Vox’s Innovative Revenue Strategies
A Developer’s Guide to Building Trade-Free, Privacy-First Scraper Appliances
Behind the Scenes: Ethical Implications of Automated Scraping
The Shifting Landscape of Online Marketing: How Scrapers Can Adapt
Mapping Data Licensing: How to Legally Use Map-Derived Signals in Commercial Products
From Our Network
Trending stories across our publication group