ekzhang/jax-js

JAX in JavaScript – ML library for the web, running on WebGPU & Wasm

What it solves

It brings high-performance, JAX-style numerical computing to the web browser. By providing a machine learning framework that runs entirely client-side, it allows developers to execute complex array operations and neural network computations on the CPU (via WebAssembly) or GPU (via WebGPU) without needing a backend server.

How it works

The library translates array operations into a compiler representation, which is then synthesized into high-performance kernels for WebAssembly and WebGPU. It maintains close API compatibility with NumPy and JAX, using a reference-counting memory model to manage resources manually in the browser environment. It supports advanced transformations like jit() for kernel fusion, grad() for automatic differentiation, and vmap() for auto-vectorization.

Who it’s for

It is designed for web developers and machine learning engineers who want to run high-performance numerical applications, neural networks, or interactive ML models directly in the browser. It is particularly useful for those who need the specific functional transformations (like JIT and autodiff) found in JAX but require a lightweight, dependency-free JavaScript implementation.

Highlights

  • High Performance: Achieves over 7000 GFLOP/s for matrix multiplication on modern hardware via WebGPU.
  • JAX-Compatible API: Familiar syntax for those used to NumPy and JAX, including support for jit, grad, and vmap.
  • Zero Dependencies: Written from scratch with no external dependencies, keeping the bundle size small (80 KB).
  • Hardware Acceleration: Supports multiple backends including WebGPU, WebGL, and multi-threaded WebAssembly.
  • Advanced Features: Includes support for Jacobian/Hessian calculations, mixed precision, and complex n-d convolutions.

Related

  • Project
  • Project
  • Project
  • Project
  • Project