AI That Runs in the Browser
Run small models on the user's own device: Transformers.js, WebGPU and WebAssembly, downloads and caches, workers, on-device search, and a safe fallback to the server.
Until now every model lived on a server. This phase moves some of the work into the browser, onto the user's own device. That can mean privacy (the text never leaves the page), no per-request cost, answers that still work offline, and no wait for the network. It also means new problems: the model is a download of many megabytes, not every device can run it, and heavy computing can freeze the page.
You will learn the tools (Transformers.js and ONNX Runtime Web, WebGPU and WebAssembly, WebLLM, and the built-in browser AI of Chrome) and the engineering around them: detecting what a device can do, downloading and caching a model with honest progress, keeping the page responsive with Web Workers, and searching by meaning on the device. The most important idea of the phase is the hybrid: try the device first, and fall back to the server when the device cannot, fails, or is not sure.
The sandbox in this site's examples is not set up to download a model, so the live examples teach every mechanism with small real code and a clearly labelled stand-in for the model (a word counter or a keyword check, not a neural network). The sandbox itself is a real browser frame, though, so the live examples also run real WebAssembly, real Web Workers and real feature checks. The real libraries appear in code blocks that do not run here, with names and versions checked against their documentation. For a real model running live in your browser, the RAG course (/rag) has one.
Practise this phase
Hands-on exercises: write the code, see your page live, and press Check to have it tested automatically.