On-Device Machine Learning

This is a note from my public notes. View the canonical version: On-Device Machine Learning.

Running machine learning models locally on the user's device rather than sending data to a remote server for inference. Also called edge ML or client-side ML. Core value proposition of the WebMachineLearning initiative and the Prompt API.

Why It Matters

Dimension Cloud Inference On-Device Inference
Privacy Data sent to server Data never leaves device
Latency Round-trip network Sub-millisecond local
Offline Not available Works without internet
Cost Per-query API fees Zero marginal cost
Throughput Rate-limited by API Limited by device hardware

Key Enablers

  • Hardware acceleration: NPUs, GPUs, and specialized ML chips in modern devices
  • Model compression: quantization, pruning, and distillation make large models fit on-device
  • Browser APIs: WebNN API, Prompt API give web apps access to device hardware
  • OS-level models: browsers can surface OS-provided models (e.g., Apple's Core ML, Google's Gemini Nano on Android)

Trade-offs

Advantages:

  • Privacy by default — no data transmitted
  • Works offline
  • No API costs
  • Low latency for real-time use cases

Limitations:

  • Model capability bounded by device compute
  • Large model downloads for first run
  • Consistency varies across devices and hardware
  • Smaller context windows than cloud models

Web Platform Connection

WebMachineLearning standardizes browser access to on-device ML. WebNN API provides the low-level hardware interface; Prompt API and Writing Assistance APIs expose higher-level LLM capabilities.

References


About Sébastien

Ready to get to the next level?

Found this valuable? Share it with someone who needs it.

Join 6,000+ readers. Get practical systems for knowledge & AI. Free.

Subscribe ✨

Free: Knowledge System Checklist

A clear roadmap to building your own knowledge system. Subscribe and get it straight to your inbox.

6,000+ readers. No spam. Unsubscribe anytime.

Subscribe