handwired: Convert JS Code to Accurate Neural Networks Without Training

chenglou/handwired

·2026.10.16 03:19

Converts general JavaScript logic into accurate neural networks without a training process. It replaces existing control structures such as if-else, loops, and state variables with matrix multiplication and ReLU operations, ensuring outputs identical to those computed by the original formulas.

Since weights are manually written, training is unnecessary, and the entire program remains differentiable. This allows single-threaded JS code to be accelerated via GPU parallel processing, or fixed logic to be combined with standard neural networks for end-to-end learning.

It uses minimal computational principles compatible with existing GPU optimization techniques, achieving millisecond-level performance in a demo of 100,000 document searches. It is released under the MIT license and can be experimentally applied in WebGPU or JS environments.

GitHub
GitHub repository

chenglou/handwired

Turn your regular JavaScript code into a neural net.

TypeScript

This introduction was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report errors, attribution issues, or removal requests via Contact.