// the find
BrainJS/brain.js
🤖 GPU accelerated Neural networks in JavaScript for Browsers and Node.js
brain.js is a neural network library for JavaScript that runs in both the browser and Node.js, with GPU acceleration via gpu.js and WebGL. It covers feedforward nets, LSTMs, GRUs, autoencoders, and convolutional layers. The target audience is JS developers who want to experiment with neural networks without leaving their existing stack.
GPU acceleration through gpu.js is a genuine differentiator — you get WebGL2/WebGL1 fallback transparently, which matters in the browser where Python ML libraries simply don't run. The API is genuinely simple: train/run with plain JS objects, no tensor juggling, no graph compilation. The toFunction() serialization trick is clever — you can export a trained network as a standalone JS function with zero runtime dependency. Test coverage is solid with both unit and end-to-end tests across all network types.
Last pushed September 2024 and the pace has been slow for years — the recurrent implementation is a custom matrix math stack rather than using gpu.js, meaning RNN/LSTM/GRU don't benefit from GPU acceleration at all. The headless-gl native dependency on Node.js is a real install pain on Windows and Linux CI; the README's own instructions warn that 'npm config set msvs_version' no longer works in modern npm. This is not the right tool for anything beyond toy-scale problems — there's no batching, no gradient checkpointing, no mixed precision, and training large datasets will hit JS memory limits before you get useful results. The FeedForward/Recurrent 'highly customizable' layer API has almost no documentation beyond the source code.