Hand-Built Neural Network Reproduces an If-Else Comparison Without Training

A developer demonstrates how a simple if-else comparison, returning 10 when a is greater than 4 and 12 otherwise, can be encoded as a neural network with fixed weights rather than learned parameters. The approach ports Cheng Lou's handwired JavaScript project to Rust as handwired-rs. The construction chains two ReLU operations to produce a flag that is 1 for values above 4 and 0 otherwise, then converts that flag into the output with a weighted sum. The author argues the value lies not in speed but in producing a fixed sequence of arithmetic steps that can be formally verified across every input. The article notes that a pure linear combination cannot represent such a decision, which is why the nonlinear ReLU is required.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in