Engrain by ByteRush

AIF.05.01 Senior

On-device models: WebGPU, WASM and built-in AI

Comes up in: Frontend system design, AI system design

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • transformers.js / ONNX Runtime Web
  • WebGPU vs WASM backends
  • model size and download cost
  • running in a worker
  • privacy benefits
  • browser built-in AI APIs (status per browser — facts)
  • good use cases (embeddings, classification, background removal) vs bad ones

Words you will know

on-device inferenceWebGPUquantised model

What you will practise

  • in-browser sentiment classifier in a worker

Interview questions this answers

  • When would you run an ML model in the browser instead of on a server?
  • What are the costs of on-device models for users on low-end phones?