My dear friends, I’d like to show you my latest toy project
Introducing Handwired: turn your regular JavaScript code into a neural net!
- no training
- exact outputs vs the JS program
- fully differentiable
All runnable in a browser, without GPU
Cheng Lou
@_chenglou
Handwired bridges the gap between traditional code and a neural net in a funny way. It turns if-else and loops into weights, like so:

2:25 AM UTC · Oct 15, 2026 · 120.2K Views
1012629154
Cheng Lou
@_chenglou
Here’s a little OS made with it. Giant scroll views, idiomatic text input, animation and styling, etc. You can check in the browser inspector that there’s no diffusion, no llm, and just regular DOM elements
Yet if you check the GitHub source, it’s a bunch of compiled neural net numbers doing inference in real time in a browser
Yet if you check the GitHub source, it’s a bunch of compiled neural net numbers doing inference in real time in a browser
2:26 AM UTC · Oct 15, 2026 · 91.9K Views
68686166
Cheng Lou
@_chenglou
Isn’t a neural net probabilistic? Yes if you train it, no if you hand-wrote the weights that correspond exactly to your program, lol 🙂
2:26 AM UTC · Oct 15, 2026 · 73.6K Views
51675967
Cheng Lou
@_chenglou
What happens in we unfreeze some of these weights and actually train them? Well you can apply existing neural net techniques to it, losses and backprops and all, and now the UI becomes a bit more “learned”
Here’s a photo gallery where on the left I edit the rectangles and the right side gives me a new view where the photos learn to align themselves, training in real time as you drag (because the param count is so tiny).
This demo done fully in JavaScript, with JS looping through them numbers and backpropping. Stupid but fun! I’ve exposed the loss param slider you can play around with
Here’s a photo gallery where on the left I edit the rectangles and the right side gives me a new view where the photos learn to align themselves, training in real time as you drag (because the param count is so tiny).
This demo done fully in JavaScript, with JS looping through them numbers and backpropping. Stupid but fun! I’ve exposed the loss param slider you can play around with
2:27 AM UTC · Oct 15, 2026 · 75.5K Views
813575134
Cheng Lou
@_chenglou
One more demo! Searching through 100k JSONs in real time. The code was written mostly traditionally, then transformed into actual WebGPU matrices to massively parallelize the JSON search. The regex, JSON parsing, highlighting & matching are all one giant exact neural net
2:27 AM UTC · Oct 15, 2026 · 63.5K Views
719632175
Cheng Lou
@_chenglou
You can also imagine attaching a specific Handwired neural program to, say, nanoGPT. Now your llm can speak both Shakespeare and that exact specific JavaScript program =D
2:27 AM UTC · Oct 15, 2026 · 59.9K Views
1428735
Cheng Lou
@_chenglou
Here’s the source & tutorial. Play with it yourself!
chenglou.me/handwired/
github.com/chenglou/handw…
chenglou.me/handwired/
github.com/chenglou/handw…
chenglou.me
Handwired: turn your regular JavaScript code into a neural net
Turn your regular JavaScript code into a neural net. No training, exact yet also fully differentiable, runnable in a browser without GPU.
2:28 AM UTC · Oct 15, 2026 · 64.5K Views
2041781912