Skip to content

On-Device & Edge Inference

The quantization zoo covered the formats that shrink a model’s weights. On-device inference is where those formats stop being an optimization and become the only way the model fits at all. Here the GPU is a phone NPU or a laptop’s unified memory, the power budget is a battery, and there is no datacenter to fall back on.

Cloud inference is the default for good reasons — but four pressures push work to the edge:

  • Privacy. The data never leaves the device. For health, keyboard, photos, or on-device assistants, “we don’t send it anywhere” is a feature you cannot fake with a privacy policy.
  • Latency. No network round-trip. A local 7B model can start streaming before a cloud request finishes its TLS handshake — and it works on a plane, in a tunnel, on bad Wi-Fi.
  • Offline. Works with no connectivity at all.
  • Zero per-token cost. This is the throughline turned inside-out. Cloud inference bills every token forever; local inference is paid once (the user’s hardware) and then free to you. At scale, moving inference onto users’ devices can erase your single largest variable cost.
Cloud: $ per token, forever, but unlimited compute
Device: $0 per token, but YOUR memory/battery/silicon budget

The edge takes the constraints from Part 1 and tightens every one:

  • Memory. A phone has ~6–12 GB of RAM shared with the whole OS; a laptop maybe 16–64 GB unified. An FP16 7B model is ~14 GB — already too big for most phones before you’ve opened any other app.
  • No datacenter GPU. No 80 GB H100, no NVLink. You get a mobile NPU or an integrated GPU with a fraction of the bandwidth.
  • Battery and thermals. Sustained inference drains the battery and heats the chip until it throttles. The constraint isn’t just peak speed; it’s speed you can sustain without cooking the phone.

What makes local inference feasible is a stack of aggressive compression and purpose-built runtimes:

  • Heavy INT4 (and lower) quantization. This is the load-bearing trick. A 7B model:

    PrecisionSizeFits a phone?
    FP16~14 GBno
    INT8~7 GBborderline
    INT4~3.5 GByes

    Worked: 7×10⁹ params × 0.5 bytes (4-bit) ≈ 3.5 GB. INT4 is what drops a 7B model from “impossible” to “runs on a flagship phone with room to spare.” Going to ~2-bit pushes even bigger models onto laptops, at rising accuracy cost.

  • llama.cpp / GGUF. A CPU-and-everything-else inference engine plus a quantized file format that made local LLMs mainstream — runs on Macs, Windows, Raspberry Pis, phones, with k-quant schemes tuned for exactly this regime.

  • Apple MLX / Core ML, and unified memory. Apple Silicon shares one memory pool between CPU and GPU, so a quantized model is reachable by the accelerator without copying — a structural advantage for on-device LLMs.

  • NPUs. Dedicated neural accelerators (Apple Neural Engine, Qualcomm Hexagon, Google Tensor) run quantized matmuls at far better performance-per-watt than the CPU — the battery-saving piece.

  • Smaller models. The other half of the answer: 1–8B models (Llama 3.2 1B/3B, Phi, Gemma, Qwen small) designed to be good enough at a size that fits. You don’t shrink a 70B to a phone; you start from a model built for the phone.

Local is not strictly better — it’s a different point on the curve.

  • Quality ceiling. The frontier 400B+ model will not run on your phone any time soon. On-device means accepting a smaller model’s quality. Many tasks (autocomplete, summarization, classification, simple agents) don’t need the frontier; some do.
  • Cold weights, slow decode. Lower memory bandwidth means slower TPOT than a datacenter GPU — fine for a chat-speed assistant, painful for bulk generation.
  • Distribution. You now ship multi-GB model files to devices and update them — an app-size and logistics cost that the cloud doesn’t have.

On-device inference is the most extreme answer to “how do we make it cheaper”: push the per-token cost to zero by spending the user’s memory and battery instead of your GPUs. The bill doesn’t vanish — it moves, and it’s bounded by what a phone can physically hold and sustain. Heavy quantization and small models are simply what it takes to fit a useful model inside that budget.

The most extreme answer to “how do we make it cheaper” — move the bill onto the user’s silicon:

  • Why does it exist? Four pressures cloud can’t satisfy: privacy (data never leaves the device), latency (no round-trip), offline operation, and zero per-token cost — local inference can erase your single largest variable cost.
  • What problem does it solve? Fitting a useful model inside a phone’s ~6–12 GB shared RAM and battery budget: feasibility = smaller model × heavier quantization, e.g. a 7B at INT4 (~3.5 GB) goes from impossible to runs-on-a-flagship.
  • What are the trade-offs? A lower quality ceiling (no frontier 400B+ on a phone), slower decode (LPDDR5 ~60 GB/s caps a 4-bit 7B near ~17 tok/s vs a datacenter GPU’s 20–50×), and multi-GB model files to distribute and update.
  • When should I avoid it? When the task genuinely needs frontier quality or bulk generation throughput — keep those in the cloud, or use a hybrid that routes easy turns local and hard ones to the cloud.
  • What breaks if I remove it? You’re back to paying per token forever and sending user data off-device — fine for many apps, but you lose the privacy, offline, and zero-marginal-cost properties entirely.
  1. Give the four main reasons to run inference on-device rather than in the cloud.
  2. Why does INT4 quantization specifically make the difference between a 7B model fitting on a phone or not? Show the arithmetic.
  3. Why is “smaller model” listed alongside quantization rather than instead of it?
  4. What structural advantage does Apple Silicon’s unified memory give on-device LLMs?
  5. Describe a realistic hybrid local/cloud design and why you’d use it.
Show answers
  1. Privacy (data never leaves the device), latency (no network round-trip), offline operation, and zero per-token cost to the operator.
  2. A 7B model is ~14 GB at FP16 (7×10⁹ × 2 bytes) — too big for a phone — but ~3.5 GB at INT4 (7×10⁹ × 0.5 bytes), which fits in a phone’s RAM with room for the OS.
  3. Feasibility is the product of model size and quantization; you can’t quantize a 70B small enough for a phone without destroying it, so you also start from a model built small (1–8B). Both knobs together get you under budget.
  4. CPU and GPU share one memory pool, so a quantized model can be used by the accelerator without copying it across separate memory spaces — saving memory and bandwidth.
  5. Route easy/short turns to a small local model (free, private, fast) and fall back to a frontier cloud model only for hard requests — minimizing cloud token cost while keeping quality available when needed.