jax-js (Website)
jax-js brings JAX-inspired numerical computing and machine learning to the browser with WebGPU and WebAssembly support.
Deep dive
- Performance: Achieves high throughput via WebGPU and WebAssembly compilation.
- Portability: Runs in all major desktop and mobile browsers.
- API: Modeled after JAX and NumPy, simplifying the transition for data scientists.
- Capabilities: Supports LLM chat, image processing, fluid simulations, and training.
- Deployment: Allows for end-to-end client-side ML without external API dependencies.
Decoder
- WebGPU: A modern web standard providing high-performance access to the underlying GPU for graphics and general-purpose computation.
- WebAssembly (Wasm): A binary instruction format that allows code written in languages like C++ or Rust to run in web browsers at near-native speed.
- JIT (Just-In-Time) compilation: A method of executing code by compiling it to machine instructions during execution rather than prior to it.
- Kernel: A small program designed to run on a processor (CPU or GPU) to perform a specific, high-performance mathematical task.
Original article
jax-js is a machine learningan ML library and compiler for the web
High-performance WebGPU and WebAssembly kernels in JavaScript. Run neural networks, image algorithms, simulations, and numerical code, all JIT compiled in your browser.
Add jax-js to your project
Zero dependencies. All major browsers, with bundlers and in JS modules.
npm install @jax-js/jax
Matrix multiplication
Billions of floating-point operations (GFLOPs) per second
Like JAX and PyTorch in your browser
jax-js is a end-to-end ML library inspired by JAX, but in pure JavaScript:
- Runs completely client-side (Chrome, Firefox, iOS, Android).
- Has close API compatibility with NumPy/JAX.
- Is written from scratch, with zero external dependencies.
jax-js is likely the most portable GPU ML framework, since it runs anywhere a browser can run. It's also simple but optimized, including a lightweight compiler that translates your high-level operations into WebGPU and WebAssembly kernels.
The goal of jax-js is to make numerical code accessible and deployable to everyone, so compute-intensive apps can run fast and locally on consumer hardware.
Live examples
Interactive demos for local AI models, simulations, geometry processing, and numerical methods.
LLM Chat
Run a small language model locally in your browser, with GPU and CPU-based inference.
Neural Cellular Automata
Grow image patterns with a tiny differentiable automaton.
Heat Method Geodesics
Compute surface distances on triangle meshes with dense solves.
Whisper ASR
Transcribe audio locally with OpenAI Whisper.
Kyutai Pocket TTS
Voice cloning AI model that runs in your browser.
Fluid Simulation
Interactive Navier-Stokes flow with WebGPU kernels.
D-FINE Detection
Run an ONNX object detector locally with WebGPU.
MobileCLIP2 Inference
Compute embeddings for book passages.
MNIST Training
Train a neural network on handwritten digits in-browser.
Principal Component Analysis
Explore components of a 3D point cloud.
Benchmarks
Compare jax-js kernels with other web ML libraries.
Resources
GitHub Repository
Check out the code and tutorial.
REPL
Try jax-js in this browser-based REPL.
API Reference
View the generated API documentation.
Fresh dev news, AI-digested daily. Never miss a trend at devoured.fyi