Handwired
Transforms regular JavaScript code into an exact, differentiable neural net of matrix multiplications and ReLU, with no training required.
At a Glance
Handwired core is released under the MIT License; free to use, copy, modify and distribute. Run locally or in the browser.
Engagement
Available On
Listed Nov 2026
About Handwired
Handwired is an open-source project by Cheng Lou that turns ordinary JavaScript programs into neural networks whose weights are written by hand rather than trained. The resulting network is exact and fully differentiable, and it can run in JavaScript or on WebGPU in a browser.
What It Is
Handwired compiles program logic such as if-else branches, loops, and state into matrix multiplication plus ReLU-style operations over floats. For example, a conditional like a > 4 ? 10 : 12 becomes basic arithmetic in which both branches compute and a ReLU-based selector picks one. The additions, multiplications, and ReLUs are then collected into a large matmul and run on JS or WebGPU.
Why the Approach Matters
Because the program reduces to only two primitives, the README says the whole program stays differentiable and the weights need no training. It also says existing GPU techniques such as fusion, sparsity, and reordering can optimize such minimal primitives. The README lists some uses: unfreezing the weights and training them, attaching a frozen program to a generic neural net and training end-to-end, and getting GPU-level parallelism from code written in a single-threaded style.
Demos and Setup
The project site includes a Mini OS, a small desktop written in JS and transformed with Handwired, rendering to regular DOM. It also has a Learned gallery, where a compiled program's weights are unfrozen and trained in real time, and a JSON search demo covering 100,000 documents with regex matching, parsing, and highlighting turned into WebGPU kernels. To run locally, clone the repo, run bun install, then bun start. The repo includes docs, src, and template folders to get started, and a tutorial is available.
Community Discussions
Be the first to start a conversation about Handwired
Share your experience with Handwired, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
Handwired core is released under the MIT License; free to use, copy, modify and distribute. Run locally or in the browser.
- MIT License
- Permission granted free of charge to use, copy, modify, merge, publish, distribute, sublicense and/or sell
- Run demos locally with bun start
- Runs on JS or WebGPU
- No training required
Capabilities
Key Features
- Transforms JavaScript control flow and state into matrix multiplication plus ReLU
- Exact, fully differentiable output with no training
- Runs on JavaScript or WebGPU
- Runs in a browser without a GPU
- Weights can be unfrozen and trained
- Frozen programs can be attached to generic neural nets for end-to-end training
- Live demos: Mini OS, Learned gallery, JSON search over 100k documents
