LearnQuestion bank

How would you get a 3B-parameter LLM running interactively on a phone-class Arm CPU, and where are the bottlenecks?

Applied LLMTechnicalHard

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Quantise to int4 with group-wise scales: ~3B x 0.5 B = ~1.5 GB weights, ~1.5-2 GB with scales/metadata, plus KV cache; decode is memory-bandwidth bound, prefill is matmul-throughput bound
  • Use SIMD dot-product kernels (i8mm, SVE/SME where available), int4 weights with int8 activations, and check accuracy against fp16/int8 baselines
  • Evaluate llama.cpp/ggml, ExecuTorch/XNNPACK, and ONNX Runtime with optimised micro-kernel libraries rather than assuming one runtime wins everywhere
  • Account for thermal throttling, battery drain, memory pressure, big.LITTLE thread placement, and KV-cache limits on context length
  • Measure TTFT and tokens/s on real devices over sustained runs, not just short bursts or peak numbers

In full

The core move is to fit the model in memory and then respect the two different bottlenecks: at int4, 3B parameters are roughly 1.5 GB of weights, realistically 1.5–2 GB once group-wise scales and metadata are included, plus a KV cache that grows with context length. Decode is bound by memory bandwidth because every weight is re-read for each generated token, while prefill is bound by matmul throughput.

weights = 3e9 params × 0.5 B (4 bits) = 1.5 GB with scales e.g. one fp16 scale per 32 weights = +0.5 bit/weight 3e9 × 4.5 bits / 8 ≈ 1.69 GB decode ceiling ≈ sustained bandwidth / bytes read per token e.g. 50 GB/s / 1.7 GB ≈ 29 tokens/s (upper bound)

I would use int4 weights with int8 activations and group-wise scales, with SIMD dot-product kernels and i8mm/SVE/SME paths where the SoC supports them, and validate perplexity/task accuracy against fp16 or int8 baselines rather than trusting the quantised number alone. I would benchmark llama.cpp/ggml, ExecuTorch/XNNPACK, and ONNX Runtime with optimised micro-kernel libraries on the actual target, because the best runtime differs by chip and OS. On-device, I would expect thermal throttling, battery drain, memory pressure, big.LITTLE thread placement, and KV-cache limits to cap context and sustained speed, so I would pin threads, keep context modest, and monitor thermals. Finally, I would report TTFT and tokens/s from sustained real-device runs, including warm-up and thermal steady state, instead of quoting a single peak number.

Corrected by an independent AI reviewer.

What a strong answer covers

  • Memory: 3B × ~0.5 B (int4) ≈ 1.5–2 GB plus KV; decode bound by memory bandwidth; prefill bound by matmul throughput
  • Kernels: SIMD dot-product, i8mm, SVE/SME instructions; int4 weights with int8 activations and group-wise scales; accuracy checks
  • Runtimes: llama.cpp/ggml, ExecuTorch/XNNPACK, ONNX Runtime with optimised micro-kernel libraries
  • Device realities: thermal throttling, battery, memory pressure, big.LITTLE thread placement, KV limits on context
  • Measure TTFT and tokens/s on real devices over sustained runs

Common mistakes

  • Treating decode as compute-bound
  • benchmarking without thermal steady state