Back to feed
News Story
Hugging Face Blog
1 sources

Hugging Face Releases @huggingface/kernels: 200+ WebGPU Kernels for Local AI

Hugging Face has released @huggingface/kernels, a library with over 200 WebGPU kernels designed to accelerate local AI inference. By leveraging WebGPU, it enables high-performance computing in the browser, offering developers a more efficient solution for running AI locally.

SynthePulse Insight · AI deep reading

Hugging Face Releases 207 WebGPU Kernels: The Underlying Revolution for In-Browser Inference

Version 1 · 1 source

Hugging Face introduces the @huggingface/kernels library and 207 WebGPU kernels, aiming to accelerate in-browser AI inference through a reproducible, benchmarkable kernel layer, and leveraging Fleet for crowdsourced testing across real hardware.

  • Hugging Face releases @huggingface/kernels, containing 207 WebGPU kernels, hosted on the Hugging Face Hub under the Apache-2.0 license.
  • Each kernel is published as a separate repository, including a manifest, correctness tests, benchmarks, and WGSL shader templates, ensuring reproducibility and versioning.
  • Fleet is an in-browser GPU benchmarking suite that crowdsources performance and correctness evidence from real devices.
  • The kernel loader supports fetching kernels from the Hub and maintains a stable API through versioned contracts.
  • Initial benchmarks show significant performance improvements on Apple M4 GPU compared to ORT WebGPU for optimized kernels.
Open section navigationWhy Start with Kernels?

Why Start with Kernels?

The Hugging Face WebAI team aims to make in-browser inference as fast and easy as possible. This requires multiple layers of effort: models need browser-friendly representations, runtimes need to build efficient execution plans, and underlying GPU operations need to adapt to a variety of devices and browser implementations.

Kernels are the foundational layer for fast browser inference because higher-level runtimes can only be as efficient as the operations they schedule. By making operations discoverable, testable, benchmarkable, and versioned, the foundational layer can be improved independently while maintaining stable contracts for upper layers.

Kernel Repositories: More Than Just Shaders

Each kernel has its own repository and kernel card on the Hub, documenting operation semantics, inputs, outputs, attributes, supported data types, source files, and runnable examples. For example, ai.onnx.Add implements element-wise addition with multi-dimensional broadcasting, and its card records input/output shapes, data types, and variants for different shapes/devices.

The repository contains manifest.json (the source of truth for the operation contract), metadata.json (kernel identifier and source), test.json (correctness tests), bench.json (benchmark cases), and *.wgsl.jinja files (parameterized WGSL implementations). This structure transforms shaders into reusable software artifacts, with interfaces inspectable without reading WGSL, correctness and performance cases published alongside implementations, and versions explicitly loadable.

Loading Kernels from the Hub

Install @huggingface/kernels@preview via npm, requiring a WebGPU-enabled browser. The getKernel function accepts a Hub repository ID and contract version, returning a function that takes typed data and shapes when called. For example, ai.onnx.Add follows the same call pattern as heavy operations like MatMul, just with different repository IDs and inputs.

Version options (e.g., version: 1) select a published kernel contract version, separate from ONNX opset, operator since_version, or model revisions, allowing applications to depend on a stable JavaScript contract while kernel implementations can evolve.

How Do Kernels Perform?

The team compared the collection against ORT WebGPU on Apple M4 GPU, using ONNX Runtime Web 1.30.0-dev.20260826-b1f76d586a. Starting from 1,756 test cases, they retained 809 cases where both sides' outputs matched.

The article mentions that optimized kernels made a significant difference, but specific numbers are not provided in the summary. Performance depends on workgroup size, memory access patterns, vectorization, data types, and fusion strategies, with the best choices varying by input shape, device, browser, and WebGPU features.

Fleet: Crowdsourced Benchmarking

Fleet is an in-browser GPU benchmarking and testing suite that runs and scores kernels on user hardware. It allows the community to contribute performance and correctness evidence from devices not covered by traditional test labs.

With user consent, each run adds private evidence, helping the team discover failures (incorrect results, pathologically slow cases, etc.), improve kernel variants, and make better optimization decisions on real hardware.

Credibility boundary

This article is based on the official Hugging Face blog, a first-party publication. Specific performance comparison numbers were not provided in the summary and thus are not included. All information comes from this source.

Insight takeaway

Hugging Face's release of 207 WebGPU kernels and the Fleet tool establishes a reproducible, optimizable foundation for browser AI inference, promising to accelerate the development of local AI applications.

Primary report

Hugging Face Blog

Primary source