Intent to Experiment: WebNN

48 views
Skip to first unread message

Chromestatus

unread,
2:50 PM (2 hours ago) 2:50 PM
to blin...@chromium.org, Rafael....@microsoft.com, dbo...@google.com, ningx...@intel.com, rei...@chromium.org
Contact emails
dbo...@google.com, rei...@chromium.org, Rafael....@microsoft.com, ningx...@intel.com

Explainer
https://github.com/webmachinelearning/webnn/blob/main/explainer.md

Specification
https://webmachinelearning.github.io/webnn

Design docs

https://docs.google.com/document/d/1kIc5NO1PU1DbGHKOsnan-tEhV01L6_K3OLA5g0o4Ts4/edit?resourcekey=0-ltUDiDZqxKgARhtNqsGJeg

Summary
WebNN seeks to enable web applications and frameworks to take advantage of native operating system services for machine learning and the underlying hardware capabilities available on a user's computer to implement consistent, efficient, and reliable ML experiences on the web.

Blink component
Blink>WebML

Web Feature ID
webnn

TAG review
https://github.com/w3ctag/design-reviews/issues/933

TAG review status
Issues addressed

Origin Trial documentation link
https://webnn.io/en/learn/get-started/quickstart

Risks


Interoperability and Compatibility
Aside from the risk that other browsers do not implement (which is trending towards unlikely given that Edge is planning to ship alongside Chrome and Firefox is planning to implement) the primary interoperability risk is that a WebNN implementation needs to abstract over the ML acceleration capabilities of the underlying platform and hardware. The specification mitigates this risk by defining a set of ML operations which must be supported and provides a feature detection mechanism for discovering additional operations that may be optionally supported. This allows developers to write broadly interoperable code by using only the required operations or design their applications to adapt to additional capabilities at runtime.

Gecko: Positive (https://github.com/mozilla/standards-positions/issues/1215#issuecomment-3520278819)

WebKit: No signal (https://github.com/WebKit/standards-positions/issues/486) Apple is participating in the WebML WG but has made no public statements about implementation.

Web developers: Positive Microsoft's ONNX runtime includes an execution provider for WebNN (https://onnxruntime.ai/docs/tutorials/web/ep-webnn.html). Google's LiteRT.js framework has announced that they are working on WebNN support (https://youtu.be/HAjotVloAvI?t=219).

Other signals: The WebNN implementation in Chromium is a collaboration between Google, Intel, and Microsoft. Edge will be launching WebNN at the same time as Chrome.

Ergonomics
For some use cases, particularly real-time ML processing of video, integration between WebNN and WebGPU is required. Support for this has been prototyped on some platforms as an `exportToGPU()` method that takes an `MLTensor` and makes it available as a `GPUBuffer` but this is not yet available on all platforms.

Activation
Most developers don't write JavaScript or WebGPU shader code to execute their ML models by hand. Instead frameworks such as LiteRT.js, ONNX Runtime Web, WebLLM or Transformers.js are used. Support for WebNN in these frameworks (already starting to appear) will be a large factor in the adoption of this API.

Security
The primary security risk is exposing the underlying platform frameworks to potentially malicious content. This is mitigated through sandboxing of the GPU process and fuzz testing. The risks are similar to WebGPU, though the expressiveness of WebNN is lower than WGSL.

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

This is a new API.


Goals for experimentation
No information provided

Ongoing technical constraints
WebNN can currently execute models on CPU across all platforms but support for GPU and NPU execution is more limited. This will expand as development continues.

Debuggability
There is currently no special DevTools support for this API beyond regular JavaScript debugging. A feature we have considered (and prototyped via an internal extension and the --webnn-coreml-dump-model, --webnn-ort-dump-model, and --webnn-tflite-dump-model browser flags) is inspecting graphs constructed by a site and exporting them in the underlying platform format so that they can be inspected with other tools.

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?
Yes

Is this feature fully tested by web-platform-tests?
Yes
https://wpt.fyi/results/webnn?label=master&label=experimental&aligned&q=webnn

DevTrial instructions
https://webnn.io/en/learn/get-started/installation

Flag name on about://flags
web-machine-learning-neural-network

Finch feature name
WebMachineLearningNeuralNetwork

Requires code in //chrome?
True

Tracking bug
https://issues.chromium.org/issues/40206287

Estimated milestones
Origin trial desktop first145
Origin trial desktop last147
DevTrial on desktop125
Origin trial Android first145
Origin trial Android last147
DevTrial on Android125
Origin trial WebView first145
Origin trial WebView last147


Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5176273954144256?gate=5186064701194240

Links to previous Intent discussions
Intent to Prototype: https://groups.google.com/a/chromium.org/g/blink-dev/c/PD6TDMDS9mg


This intent message was generated by Chrome Platform Status.

Reilly Grant

unread,
2:52 PM (2 hours ago) 2:52 PM
to blink-dev, Chromestatus, Rafael....@microsoft.com, dbo...@google.com, ningx...@intel.com, Reilly Grant
Due to GoogleChrome/chromium-dashboard#4155 this wasn't filled in. It should read:

The goal of this experiment is to understand how well real-world models abstract to the operations supported by WebNN and how well WebNN can map these operations to those supported by the hardware of real-world users.

Rick Byers

unread,
4:09 PM (25 minutes ago) 4:09 PM
to Reilly Grant, blink-dev, Chromestatus, Rafael....@microsoft.com, dbo...@google.com, ningx...@intel.com
Glad to see this in OT, hope to see some cool things in the wild soon! LGTM to experiment 145-147 inclusive. 

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/70b6585e-7685-45d6-9507-dbbf586799ecn%40chromium.org.
Reply all
Reply to author
Forward
0 new messages