Skip to main content

On-Device & Edge AI Inference

On-device AI inference takes an already-compressed model and asks a second, separate question: given this specific phone's chip, battery, and thermal envelope, how do you actually run it there without draining the battery, overheating the device, or missing the app's latency target.

Advanced5 min readv1.0Updated Jul 10, 2026
AI-assisted content β€” reviewed by the author, but verify important details independently

Visual SummaryClick to explore

Learning Objectives

  • Distinguish on-device deployment concerns from the model-compression techniques covered in AI-065.
  • Identify mobile NPU hardware such as Apple Neural Engine and Qualcomm Hexagon and what they optimize for.
  • Compare on-device frameworks: Core ML, TensorFlow Lite/LiteRT, ONNX Runtime Mobile, and MLC.
  • Weigh battery, thermal, latency, and offline constraints when deciding on-device versus cloud inference.
  • Recognize the common mistakes teams make when shipping on-device AI features.

Why This Matters

AI-065 covers quantization and distillation: making a model smaller and cheaper to run in the abstract. On-device inference is what happens after that: taking a compressed model and deploying it to hardware with real, hard constraints a cloud GPU never has to think about. A cloud server doesn't care if inference makes it hot to the touch or drains its battery in twenty minutes; a phone in someone's pocket does. Getting a model small enough to fit is necessary but not sufficient, you still have to get it running fast, cool, and battery-friendly on a specific chip, which is a distinct engineering discipline with its own hardware, frameworks, and failure modes.

Everyday Analogy

Shrinking a suitcase's contents down to fit airline carry-on size (compression) is a different problem from actually fitting that suitcase into the overhead bin of a specific, cramped regional jet without it falling out mid-flight (on-device deployment). You can pack perfectly and still find the bin is the wrong shape for your bag, or that stuffing it in overheats your patience faster than the actual plane. On-device AI is the second problem: not "is this small enough," but "does this actually fit and run well in this exact device."

Why Inference Moves to the Edge

Three forces push inference off the cloud and onto the device itself:

  • Latency. A round trip to a cloud API, even a fast one, adds tens to hundreds of milliseconds of network time before inference even starts. For features like live camera translation, on-device transcription, or predictive keyboard suggestions, that round trip is the dominant cost, and running locally eliminates it entirely.
  • Privacy and offline capability. Some data (photos, health metrics, on-device messages) should never leave the device for regulatory, trust, or product reasons. On-device inference also keeps features working with no network connection at all, a hard requirement for some products.
  • Cost at scale. Running inference for every user on cloud infrastructure has a per-request cost that scales with usage. Running it on the user's own hardware shifts that compute cost off the provider's bill entirely, which matters enormously at consumer-app scale.

Mobile NPU Hardware

Modern phones ship dedicated silicon for AI inference, separate from the general-purpose CPU and GPU, because matrix-multiplication-heavy neural network workloads run far more efficiently on purpose-built hardware:

  • Apple Neural Engine (ANE). Apple's dedicated NPU, present in iPhone and iPad chips since the A11 Bionic, and in Apple Silicon Macs, built to run Core ML models with high throughput per watt, a critical metric on battery-powered devices.
  • Qualcomm Hexagon. Qualcomm's NPU inside Snapdragon chips, used across the majority of Android flagship and mid-range devices, with a dedicated software stack (the Qualcomm AI Engine) for compiling and running models on it.
  • Google Tensor. Google's own silicon in Pixel phones, includes a dedicated ML core built specifically to run Google's on-device models (like those behind Pixel's live transcription and photo features) efficiently.

The presence of an NPU is what makes running a modestly sized model on a phone practical at all: the same model run on a phone's general-purpose CPU alone would be dramatically slower and drain the battery far faster.

On-Device Frameworks

Framework Platform What it's known for
Core ML Apple (iOS, iPadOS, macOS) Apple's native framework for converting and running models on the Apple Neural Engine, GPU, or CPU, with automatic hardware selection
TensorFlow Lite / LiteRT Cross-platform, especially Android Google's lightweight runtime for deploying TensorFlow (and increasingly other framework) models to mobile and embedded devices; rebranded LiteRT to reflect broader framework support
ONNX Runtime Mobile Cross-platform Runs models exported to the ONNX format on mobile devices, useful for teams that train in PyTorch or another framework and want one export path to multiple device targets
MLC (Machine Learning Compilation / MLC-LLM) Cross-platform, GPU-focused Compiles LLMs specifically for efficient on-device execution across a wide range of hardware backends, notably used to run open-weight LLMs directly on phones and laptops

Choosing a framework is largely a function of platform target and where the model came from: Core ML for an Apple-only app, TensorFlow Lite or ONNX Runtime Mobile for cross-platform, MLC when the target is running an LLM specifically rather than a smaller task-specific model.

The On-Device vs. Cloud Decision

Factor Favors on-device Favors cloud
Latency requirement Sub-100ms, real-time (camera, keyboard) Tolerant of a few hundred ms to seconds
Model size needed Small enough to quantize/distill to device-friendly size (AI-065) Needs frontier-scale capability no phone can host
Privacy requirement Data must never leave the device Less sensitive, or already cloud-processed elsewhere
Connectivity Must work fully offline Reliable connectivity assumed
Battery/thermal budget Feature runs briefly or infrequently Feature would run continuously, better offloaded
Update cadence Model updates infrequently Model needs frequent updates without app releases

Most real products land on a hybrid: a small on-device model handles the common, latency-sensitive case (live keyboard suggestions, on-device face detection), with a cloud model handling harder or less frequent requests that can tolerate a round trip.

Real-World Showcase

  • Apple's on-device features, Face ID, Live Text, on-device Siri speech recognition, and on-device large-language-model features introduced with Apple Intelligence, run through Core ML on the Apple Neural Engine specifically to keep sensitive data off Apple's servers.
  • Google's Gboard keyboard runs next-word prediction and Smart Compose on-device via TensorFlow Lite/LiteRT, achieving keystroke-level latency that a cloud round trip could never hit.
  • MLC-LLM has been used by hobbyists and researchers to run quantized versions of open-weight models like Llama directly on phones and laptops, demonstrating that even multi-billion-parameter LLMs are becoming practical on-device targets, not just small task-specific models.

Try It Yourself

  1. Pick a mobile AI feature you use daily (keyboard prediction, camera filters, voice-to-text) and reason through the table above: which factors push it toward on-device versus cloud, and does the app's actual behavior match your prediction?
  2. Compare Core ML and TensorFlow Lite/LiteRT for a cross-platform app that needs the same feature on both iOS and Android: what's the tradeoff between using each platform's native framework versus a single cross-platform one like ONNX Runtime Mobile?
  3. Sketch a hybrid architecture for a photo-editing app: which operations run on-device via the phone's NPU, and which fall back to a cloud model, and what's the signal that decides which path a given request takes?

Common Mistakes

  • Assuming a quantized model (AI-065) that's small enough in file size will automatically run fast on-device, without accounting for how well it maps onto the target NPU's supported operations.
  • Ignoring thermal throttling: a model that runs fast in a five-second benchmark can slow dramatically during sustained real-world use as the chip heats up and throttles performance.
  • Shipping a single model file and assuming it runs identically across all supported devices, when older or budget-tier phones without a comparable NPU may fall back to much slower CPU execution.
  • Treating on-device and cloud inference as a binary choice for an entire feature, missing the common hybrid pattern where the easy case runs locally and the hard case escalates to the cloud.
  • Underestimating battery impact testing, shipping a feature that works fine in short demos but drains a meaningful share of battery during a full day of real use.

Key Takeaways

  • On-device inference is distinct from the model-compression techniques in AI-065: compression makes a model small enough to consider deploying, on-device engineering makes it actually run well on specific hardware.
  • Dedicated NPU hardware, Apple Neural Engine, Qualcomm Hexagon, Google Tensor, is what makes practical on-device inference possible at all, versus running on a general-purpose CPU.
  • Core ML, TensorFlow Lite/LiteRT, ONNX Runtime Mobile, and MLC each target different platform and model combinations, and the right choice depends on your target OS and model type.
  • Latency, privacy, offline capability, and cost at scale are the forces pulling inference to the edge; frontier-scale capability and infrequent usage pull it back to the cloud.
  • Most production features land on a hybrid architecture, not an all-or-nothing choice between on-device and cloud.

Glossary

On-Device Inference
Running a model directly on a user's hardware rather than a cloud server, subject to that device's compute, battery, and thermal limits. (see AI-065)
NPU (Neural Processing Unit)
Dedicated silicon built specifically to run neural network workloads efficiently, separate from a device's general-purpose CPU and GPU.
Apple Neural Engine
Apple's dedicated NPU, present since the A11 Bionic chip, built to run Core ML models with high throughput per watt.
Qualcomm Hexagon
Qualcomm's NPU inside Snapdragon chips, used across most Android flagship and mid-range devices.
Core ML
Apple's native framework for converting and running models on the Apple Neural Engine, GPU, or CPU with automatic hardware selection.
TensorFlow Lite / LiteRT
Google's lightweight runtime for deploying models to mobile and embedded devices, rebranded LiteRT to reflect broader framework support.
ONNX Runtime Mobile
A cross-platform runtime for running models exported to the ONNX format on mobile devices.
MLC (Machine Learning Compilation)
A compilation framework for running LLMs efficiently on-device across a wide range of hardware backends.
Thermal Throttling
A chip reducing its performance under sustained load to manage heat, which can slow on-device inference during real-world use.
Hybrid Architecture
A deployment pattern where a small on-device model handles common, latency-sensitive cases while harder requests escalate to a cloud model.

References

Diagram

Loading diagram…

Knowledge Check

8 questions