#1072: Updated review of Web Neural Network API

Visit on Github.

Opened Mar 20, 2025

Hello TAG!

I'm requesting an updated TAG review of WebNN API - previous TAG review: #933

Further details:

  • I have reviewed the TAG's Web Platform Design Principles
  • Previous early design review, if any: 2000, 2022, 2024
  • Relevant time constraints or deadlines: We plan to publish a new CRS during Q2 2025
  • The group where the work on this specification is currently being done: W3C Web Machine Learning Working Group
  • Major unresolved issues with or opposition to this specification: none
  • This work is being funded by:

You should also know that...

Below is a summary of substantive changes since the previous TAG review in 2024 to assist you in this delta review.

Significant new features:

  • Add 12 new operators ("Wave 3") to support well-known transformer models based on an analysis of top 20 downloaded Hugging Face models. The models comprise of a diverse set of tasks, including Small Language Models and Large Language Models, object detection, sentence similarity, feature extraction, speech recognition, image segmentation, text classification, and text generation. See issue, PR, presentation for details on these operators and motivation.
  • Add MLTensor interface that represents a tensor, an input or output to an MLGraph. Update MLContext interface with new createTensor(), readTensor(), writeTensor() methods, change compute() to dispatch() for scheduling the workload, add new destroy() method for MLContext, MLGraph, MLTensor. These changes allow buffer reuse, chained inference, better resource management with explicit destruction, and the opportunity to share memory with WebGPU, minimizing copies. See MLTensor Explainer for details.

Other substantial changes:

The group would like to seek TAG's explicit advise on the following:

Discussions

Log in to see TAG-private discussions.

Discussed Apr 1, 2025 (See Github)

Move to Breakout C

Discussed Apr 1, 2025 (See Github)

Jeffrey: Lola was concerned about environmental impact and multi-implementer support... I think it's worth sending these to the group.

Jeffrey to channel this to public.

Christian: There is a WebML working group meeting tomorrow. It would be great if they can review the comments then.

Torgo: How do people feel about the environmental impact question? AI should be scrutinized, but this is about being on-device. Environmental impact might not be as much of a factor as in a cluster.

Jeffrey: There are arguments in all sorts of directions, and we don't have the appropriate measurements. We should ask the WG to consider this, and not try to give them an answer.

Torgo: And it depends on what work you're doing. You'll probably only ask the device to do things that are appropirate to the device. If there's something focused on private data, then that makes sense to do on the device. One reason for the API is to make things more efficient: to take advantage of the lower-power processor on the device.

Dan: This would also apply to the Writing Assistance review, which is still in progress. Lots of the efficiency arguments apply the same way.

Jeffrey: Another consideration (which the Chrome team on this is considering) is whether we want this extra whole language in the platform, on top of Wasm and WebGPU.