Hraness
Theme
Appearance

saved

Handwired: turn your regular JavaScript code into a neural net

by Cheng Louchenglou.mepublished

Hraness wrote this summary from a saved copy of the source. Quotations are taken word for word from the source.

gist

Cheng Lou's Handwired compiles ordinary JavaScript into an exact neural network of ReLUs and weighted sums that needs no training, stays fully differentiable, and runs in a browser without a GPU. The landing page shows a ternary rewritten as ReLU arithmetic and links demos of a small desktop OS, a gallery whose compiled weights train live, and WebGPU search over 100,000 JSON documents.

ideas

  • Branches become arithmetic. The ternary a > 4 ? 10 : 12 becomes above4 = relu(a - 4) - relu(a - 5), which blends both branches by a 1-or-0 weight.
  • Code is the net. The circuit figure draws that arithmetic as wires and boxes, so the program itself is a two-ReLU network rather than a trained approximation.
  • Real apps compile. The Mini OS demo, with lists, animation, drag, input, and pictures rendering to the DOM, compiles to 9,909 weights in 130 layers with zero training.
  • Differentiable means trainable. The learned gallery unfreezes a compiled program's weights and trains them live, and JSON search runs as WebGPU kernels.

quotes

“No training, exact yet also fully differentiable, runnable in a browser without GPU.”

Handwired landing page.

“A small desktop written in JS, transformed with Handwired.”

Handwired landing page, Mini OS demo.

“The regex matching, JSON parsing & highlighting are all written in JS, then turned into WebGPU kernels for massive parallelism.”

Handwired landing page, JSON search demo.