We shipped 207 WebGPU Kernels for Browser AI
- Source
- youtube.com
- Author
- Hugging Face
- Date
Context
Hugging Face has published 207 small GPU programs, called kernels, so machine learning can run quickly in a web browser, and a short video shows how they fit together. A model is a graph of operations such as add or matrix multiply, and a kernel is the version of one operation written for specific hardware. In the browser that means WGSL, the shader language of the WebGPU interface.
The kernels are shipped as Jinja templates instead of fixed WGSL files, so a loader can fill in data types and workgroup sizes to suit the user's GPU. The Hugging Face kernels library loads a kernel, validates it, selects a suitable setting, renders the shader and runs it behind a simple JavaScript call. The presenter shows a calculation in about 20 lines using the matmul, softmax, add and layer-norm kernels.
In one demo of over a million cells, the GPU version runs at the display's 60 frames per second against about 7 for plain JavaScript on the presenter's machine. That is a single demo on one device.
- Hugging Face released 200+ open-source WebGPU kernels on the Hub plus a Hugging Face Kernels JS library that loads a kernel from the Hub by ID and version and hides the JavaScript-to-GPU glue code behind an async .
- Kernels ship as Jinja templates rather than fixed WGSL, so the browser renders a variant suited to the device, for example a wider data type or larger workgroup size where the GPU supports it.
- The demo builds an attention mechanism in about 20 lines of JavaScript from matmul, softmax, add and layer-norm kernels; a single-matmul animation over a million cells ran at the 60 fps display cap versus about 6.75 fps in plain JS.
- A companion tool, Fleet, benchmarks the kernels on the visitor's own GPU, and the team says that data will feed further per-device optimization.
- transformer — The neural network architecture behind modern AI models, built on attention — letting every word directly consider every other word in parallel.
- attention — The mechanism that lets a model weigh which earlier words matter for the word it's currently processing — the core operation of a transformer.
- Inference — Using a trained model to produce an output from a supplied input.
- Function — A named block of instructions that takes inputs, called arguments, and hands back a result, called its return value.
Checking sign-in…
Loading comments…






