Friday, March 28, 2025

How WebNN Can Be Used To Develop AI PCs Applications

Overview

AI PC application development is unified by the Web Neural Network (WebNN) standard, which effectively speeds up CPUs, GPUs, and NPUs.

AI PCs are opening up new possibilities for local AI implementations and portability. Discover how to achieve optimal performance and predictable behavior by standardizing interactions with CPUs, GPUs, and NPUs using the WebNN API.

Developers may now freely experiment locally without relying on cloud services with the advent of Intel Core Ultra processors, which also offer the best freedom for local AI projects.

Web Neural Network API (WebNN)

Bridging software and hardware for scalable, web-based solutions has been a persistent difficulty as machine learning advances. In many well-known browsers running Intel platforms, WebNN, a specification that enables developers to implement AI fully within a web browser, is becoming enabled. Machine learning networks can now be built, assembled, and operated by web apps. Utilize WebNN to run AI more effectively by utilizing lower-level acceleration libraries.

Hardware

Although WebNN requires an Intel Core processor of at least the 12th generation or higher, it can run on the newest Intel Core Ultra CPUs.

How to Install

WebNN needs Windows 11 v21H2 (Direct Machine Learning [DirectML] 1.6.0) or later and a suitable browser to function. Try the most recent versions of Microsoft Edge Canary or Google Chrome Canary, which need turning on WebNN feature in the settings.
Get the most recent version of Microsoft Edge Canary or Google Chrome Canary.

  • To activate WebNN, type chrome://flags into the URL bar of your browser and hit Enter. A page titled Experiments appears.
  • Type webnn into the Search flags box.
  • Makes the WebNN API visible.
  • Then choose Enabled from the drop-down option.
  • Restart your web browser.

Web Neural Network API Explained

One area of artificial intelligence is machine learning (ML). With its many neural network designs, the machine learning area known as “Deep Learning” opens up new and captivating user experiences for web applications. Use cases include enhanced video conferencing and features that increase accessibility, with the possibility of increased privacy compared to cloud-based solutions. The following are some typical use cases that are applicable to a variety of web applications:

  • Person detection
  • Face detection
  • Semantic segmentation
  • Skeleton detection
  • Style transfer
  • Super resolution
  • Image captioning
  • Machine translation
  • Noise suppression

Even though some of these use cases can be implemented in a limited way using current Web APIs (such as the WebGL graphics API, as shown by the WebNN API polyfill and the first-wave JS ML frameworks), the scope of experiences is limited and inefficient implementations on contemporary hardware result from the lack of access to platform capabilities that are advantageous for ML, such as specialized ML hardware accelerators. When compared to native platforms, this puts the online platform at a disadvantage.

The first step in the Web Neural Network API (WebNN API) design process was determining the primary use cases in collaboration with a wide range of stakeholders, including web developers, interested hardware providers, major browser vendors, and important ML JS frameworks. Following the discovery of the most important use cases, the team broke them down into requirements and worked their way down the levels of abstraction. Prioritizing user needs was the goal of this use case-driven design method.

Bringing together a solution that scales across hardware platforms and works with any framework for web-based machine learning experiences is one of the primary challenges facing the web as a result of the emergence of ML innovations in both the software and hardware ecosystems. As an abstraction for neural networks in online browsers, we suggest the WebNN API.

The Web Neural Network API
Image credit to Intel

Web browsers can use the operating system’s native machine learning API to implement the WebNN API, as shown in the architecture diagram in the above figure. Through a hardware-agnostic abstraction layer, this architecture bridges the gap between software and hardware, enabling JavaScript frameworks to leverage state-of-the-art machine learning innovations in the operating system and the hardware platform beneath it without being constrained by platform-specific capabilities.

A computational graph of mathematical processes lies at the core of neural networks. These functions serve as the foundation for contemporary machine learning systems in robotics, computer vision, and natural language processing.

A specification for building and running neural network computational graphs is the WebNN API. It gives online apps the capability to build, assemble, and execute machine learning networks within web browsers. For optimal performance and dependable results, the WebNN API can be implemented in web browsers using the native operating system machine learning APIs that are currently available.

Goals

In order to provide consistent, effective, and dependable machine learning experiences on the web platform, web apps and frameworks can leverage the underlying hardware breakthroughs on users’ machines as well as the native operating system services for machine learning.

Non-goals

  • The model serialization format is not defined by us. Formats are framework selections that can vary by vendor. The WebNN API’s function is to leverage the target platform’s underlying infrastructure to enable solutions that function throughout the web, irrespective of the model format, for dependable and effective outcomes.
  • The specify how machine learning models are packaged or delivered, including the encryption and content security options.
  • Any kind of media, including audio signals, pictures, and video streams, can be used as input for the machine learning model. Intel depend on the current web standards for media types required for the various scenarios rather than defining new ones.

Target hardware

Web apps and frameworks can be used on common computing devices running widely used operating systems. Early prototypes perform admirably on the following:

  • Smartphones, such as the Google Pixel 3 or comparable
  • Computers such as the 13″ MacBook Pro 2015 or comparable

The WebNN API can be implemented using the major platform APIs that are currently in use, including:

  • Neural Networks API for Android
  • DirectML API for Windows
  • ML Compute API for macOS/iOS

These platform APIs may utilize general-purpose GPUs, CPU parallelism, or specialized hardware accelerators for machine learning, depending on the underlying hardware capabilities. Although it is hardware agnostic, the WebNN API offers options for performance adaptation.

Getting started

A computational graph, a directed graph with nodes representing operations (ops) and input variables, is a fundamental abstraction of well-known neural networks. The output value of one node serves as the input value for another node. This abstraction is made available on the web by the WebNN API.

The MLOperand objects in the WebNN API stand for input, output, and constant multi-dimensional arrays called tensors. This computational graph can be constructed and executed more easily with a set of operations defined by the MLContext. Dedicated hardware, such as GPUs, CPUs with deep learning extensions, or ML accelerators, can speed up these processes. Models that handle important application use cases necessitate certain WebNN API-defined activities.

The WebNN API also offers affordances for creating, compiling, running, and integrating a computational graph with other Web APIs that supply input data for the graph, such as media APIs for picture or video frames and sensor APIs for sensory data. For more information, see the overview of the programming model.

The specification has an example that takes four inputs, creates, compiles, and runs a graph with three operations, and outputs one result.

Drakshi
Drakshi
Since June 2023, Drakshi has been writing articles of Artificial Intelligence for govindhtech. She was a postgraduate in business administration. She was an enthusiast of Artificial Intelligence.
RELATED ARTICLES

Recent Posts

Popular Post