Show HN: Jax-JS, array library in JavaScript targeting WebGPU
4 months ago
- #javascript
- #web-development
- #machine-learning
- jax-js is a machine learning library for the web, reimplementing Google DeepMind's JAX framework in pure JavaScript.
- It runs in the browser using WebGPU and WebAssembly for near-native performance, enabling numerical computing on the frontend.
- The library provides APIs similar to JAX, including automatic differentiation (grad), vectorization (vmap), and just-in-time compilation (jit).
- jax-js supports training neural networks in the browser, with examples like MNIST achieving >99% accuracy in seconds.
- It leverages WebGPU for GPU acceleration, generating optimized kernels for operations like matrix multiplication.
- The project is open-source and available on npm, with 0 dependencies and pure JavaScript implementation.
- Performance is competitive, with matrix multiplication reaching >3 TFLOP/s on modern hardware.
- The library includes features like hot module reloading, allowing real-time code edits during model training.
- Future improvements could include WebAssembly optimizations, WebGL fallback, and additional JAX feature parity.
- The project demonstrates the potential for full ML frameworks to run in browsers, beyond traditional model runtimes like ONNX.