Skip to content
Octopus Research Institute
TR-2026-0050Technical reportPeer review: Not peer reviewedEvidence: ExperimentalStatus: Released

A sovereign ARM-NEON CPU inference backend (Raspberry Pi 4B): Q8 and multicore are complementary, not additive

Ran Tao (Octoryn Research)

This is not peer-reviewed. Treat it as a working document, not a validated result.

Abstract

A CPU-only inference backend was brought up on a Raspberry Pi 4B (Cortex-A72, ARMv8.0-A) as hand-written ARM-NEON C++ with no BLAS/HIP/CUDA. Two dense decoders (~0.36B Llama-style, ~0.5B Qwen2-style) match a recent fp32 reference (cosine 1.0 and 0.99999988), byte-identical across two boards. On this bandwidth-starved target, 8-bit weight quantization and multicore threading are complementary, not additive: neither alone moved decode throughput; only Q8 plus four threads won (~9.83 tok/s, ~3.65x). A clock-sensitivity control confirms Q8 flips the workload compute-bound. Single measured run.

A sovereign ARM-NEON CPU inference backend (Raspberry Pi 4B): Q8 and multicore are complementary, not additive

1. Contribution

Claimed. We brought up a CPU-only text inference backend from zero on the Raspberry Pi 4B (Cortex-A72, ARMv8.0-A) as pure hand-written ARM-NEON host C++ with zero BLAS/HIP/CUDA (a dynamic-library check shows only the C/C++ runtime and math library). Two dense decoder architectures run end to end without external math libraries: a ~0.36B Llama-style model (no attention bias) and a ~0.5B Qwen2-style model (with QKV bias). The load-bearing research result is a composition finding on a bandwidth-starved edge target: narrow weights (fp16/Q8) and multicore threading are complementary, not additive. Neither quantization alone nor threading alone moved decode throughput; only Q8 combined with 4 threads won (~3.65x). This echoes an earlier GPU-side observation that Q8 is "memory-mode-positive / compute-mode-negative," now reproduced on a CPU-only backend.

NOT claimed. We do NOT claim a production-serving stack, batched/chunked prefill, cross-box single-stream tensor/pipeline parallel, MoE/SSM/RWKV/fused-QKV coverage, sustained-thermal endurance, or multi-run statistical variance on the throughput numbers. The throughput figures are single measured runs under one governor/clock condition. The two-box figure is aggregate throughput over independent requests, not a single-stream speedup.

2. Methods

AspectValue
ModelsA ~0.36B Llama-style dense decoder (tied embeddings, no attention bias) and a ~0.5B Qwen2-style dense decoder (tied embeddings, with QKV bias).
Hardware2-node Pi 4B cluster. Node A: 8GB, A72 @ 1.8GHz. Node B: 4GB, A72 @ 1.5GHz. Both aarch64 Linux. A72 = ARMv8.0-A: CPU features are fp asimd only — NO int8 dot-product, NO native fp16 arithmetic. fp16↔fp32 conversion is base v8.0 and is used.
BuildOn-box C++20 build with -O3 and OpenMP for an ARMv8-A target using a recent GCC. Development on an Apple-silicon Mac (also aarch64 + NEON, v8.0 baseline); final parity and throughput measured on-box.
OracleA recent transformers fp32 build, identical token ids.
PrecisionWeights load bf16→fp32, then optionally fp16 or group-wise symmetric 8-bit. All GEMV accumulation is fp32 (A72 has no int8 dot-product).
MeasurementDecode tok/s on-box, greedy, CPU governor pinned to performance. Kernel micro-parity vs double-precision references.

3. Results

Correctness / parity (vs a recent transformers fp32 oracle).

ModelPrecisionCosine vs referenceArgmax/top-5
Llama-style ~0.36Bfp321.0000000000identical
Llama-style ~0.36Bfp161.000000match
Llama-style ~0.36Bq80.999901match
Qwen2-style ~0.5Bfp320.99999988identical

Kernel micro-parity (NEON vs scalar/double reference, on the dev Mac and both A72 nodes): GEMV f32/f16/q8 max_abs ≤ 1e-5; norm/rope/swiglu/gelu max_abs < 3.4e-7; attention decode (GQA) max_abs < 1e-7; composed 2-layer block cosine = 1.0. Generations are byte-identical across both Pi nodes on a fixed prompt.

Throughput — the composition finding (Llama-style ~0.36B decode, Node A 4 cores @ 1.8GHz, greedy, single run).

Precisionweight bytes/tokencosine vs reference1 thread4 threadsmulticore speedup
fp32~1.45 GB1.0 (ref)2.842.72none
fp16~724 MB1.0000003.015.131.7x
q8~362 MB0.9999012.699.833.65x

Mechanism:

  1. fp32 is memory-bandwidth-bound. Roughly 1.45 GB of weight traffic per token saturates the single LPDDR4 bus; adding cores does not help (they stall on the same bus) and CPU clock does not matter.
  2. Q8 single-thread is a wash (~2.69 vs fp32 2.84). A72 has no int8 dot-product, so the int8→fp32 dequant adds roughly 2x the vector ops of fp32's fused-multiply-add, approximately cancelling the 4x weight-bandwidth saving. Q8 alone is a memory-footprint win, not a speed win.
  3. Q8 + 4 threads is the win (~3.65x, 9.83 tok/s). Cutting weight traffic to ~362 MB/token frees enough bandwidth that the workload flips compute-bound and the 4 cores parallelise. The speedup tracks bytes-freed monotonically (none → 1.7x → 3.65x).

2-node data-parallel (Llama-style ~0.36B q8 / 4T). Concurrent independent streams: Node A 9.75 + Node B 8.33 = ~18 tok/s aggregate. This is aggregate throughput over INDEPENDENT requests (data-parallel), NOT one stream made faster.

4. Ablations / negative controls

  • Clock-sensitivity flip (the mechanism's confirming control). Under Q8+4T the workload is clock-dependent: Node B @ 1.5GHz = 8.40 tok/s, ~14% below Node A @ 1.8GHz's 9.83, matching the 1.5/1.8 clock ratio. Under bandwidth-bound fp32, clock does not matter. This flip is the positive evidence that Q8 moved the workload from bandwidth-bound to compute-bound.
  • rms_norm_eps perturbation: moving the norm epsilon far off its configured value collapses cosine to −0.67 and the output degenerates to "is is is is". Proves the norm path is load-bearing and config is honoured. (Source note: the Llama-style config ships eps=1e-5, NOT 1e-6 — a recurring trap.)
  • rope_theta perturbation (1e5 → 1e4): argmax flips (Paris → the), text degrades. Honest caveat: cosine only dips to 0.9999 at 5-token context (RoPE angles are tiny there), so the argmax flip — not cosine — is the discriminating signal; cosine is weak on short prompts.

5. Threats to validity / limitations

  • Single-run throughput, no variance. All tok/s figures are single measured runs under one governor (performance) / one clock condition. No multi-run mean/std is recorded — hence evidence level is experimental, not reproduced. (Correctness, by contrast, was confirmed byte-identical across two boxes.)
  • Decode only (M=1). Prefill reuses the same per-token path; no chunked/batched prefill.
  • Coverage. Only two dense architectures (Llama no-bias, Qwen2 QKV-bias). Fused-QKV, scalar-multiplier, MoE, SSM/RWKV not yet wired.
  • Kernel correctness-first overheads. Attention recopies a compact KV slice per layer per token (a strided-view kernel would remove the copy); transcendentals use exact libm scalar (vectorized polynomial approximations are future work). These bound absolute tok/s but do not affect the relative composition finding.
  • Thermal. Both boxes idle ~45-50°C, no throttling observed; sustained multi-minute decode under load was NOT endurance-tested.
  • Bandwidth figure is effective, not bus-spec. The ~4 GB/s effective bus figure underlying the mechanism narrative is an observed-saturation interpretation, not an independently profiled bus benchmark.
  • 2-box aggregate is not single-stream. Cross-box single-stream tensor/pipeline parallel is LAN-latency-bound and out of scope.

6. Reproducibility (high-level)

The implementation is a config-driven driver over hand-written NEON kernels, reusing an external-math-library-free safetensors loader and a BPE tokenizer (Llama- and Qwen-compatible), with a header-only JSON dependency vendored to the on-box build directory. Provisioning sets swap and pins the CPU governor to performance; deployment builds on-box with the recent GCC toolchain noted above. Parity is validated by dumping last-token logits and comparing to the transformers fp32 oracle.

Claim boundary

The author's explicit scope — what this work does and does not establish — carried over from the Octoryn Research publishing model.

Proves

  • On Cortex-A72 / ARMv8.0 (no int8 dot-product), 8-bit weight quantization alone is a memory/footprint win not a speed win, and fp32 multithreading is bus-bound; only Q8 combined with four threads wins (~9.83 tok/s, ~3.65x).
  • A clock-sensitivity control (Q8+4T scales with the CPU clock ratio while fp32 does not) confirms Q8 moves the workload from bandwidth-bound to compute-bound.
  • Sovereign correctness: the two dense models match a recent fp32 transformers reference (cosine 1.0 and 0.99999988), byte-identical across two boards, with no BLAS/HIP/CUDA linkage.

Does not prove

  • No multi-run or statistical variance on throughput; tok/s are single runs under one governor and clock, so the numbers are not reproduced-grade.
  • Not a serving or production stack; decode-only (M=1), with no batched or chunked prefill and no single-stream cross-board parallelism.
  • Says nothing about MoE/SSM/RWKV/fused-QKV, larger models, sustained thermal endurance, or non-A72 ARM cores with an int8 dot-product or native fp16 arithmetic.

Applies when

  • Cortex-A72 / ARMv8.0-A class cores (fp + asimd only, no int8 dot-product, no native fp16 arithmetic) on a single shared LPDDR4 memory bus.
  • Small dense decoder LLMs (~0.36B-0.5B), greedy decode, CPU governor set to performance, group-wise symmetric 8-bit weight quantization.
  • A memory-bandwidth-bound regime where per-token weight traffic saturates the bus.

Does not apply when

  • ARMv8.2+ cores with an int8 dot-product or native fp16 arithmetic, where the int8 dequant overhead is absent.
  • GPU or accelerator backends, or compute-bound regimes where memory bandwidth is not the limiter.
  • Batched or multi-request serving, prefill-dominated workloads, or single-stream cross-node tensor/pipeline parallelism.

Authors

  • Ran Tao — Investigation, Writing

Cite this

Citation

Tao, R., Octoryn Research. (2026). A sovereign ARM-NEON CPU inference backend (Raspberry Pi 4B): Q8 and multicore are complementary, not additive (TR-2026-0050). Octopus Research Institute.

BibTeX

@techreport{oritr20260050,
  title       = {A sovereign ARM-NEON CPU inference backend (Raspberry Pi 4B): Q8 and multicore are complementary, not additive},
  author      = {Tao, Ran and {Octoryn Research}},
  institution = {Octopus Research Institute},
  year        = {2026},
  note        = {Permanent ID TR-2026-0050. Not peer reviewed.}
}

Disclosures

Funding
Hardware and infrastructure provided by Octoryn / Octopus Core Pty Ltd.
Conflicts of interest
Octoryn ships commercial inference and governance tooling; findings are reported independently.