{
"$type": "site.standard.document",
"content": "---\ntitle: \"Mini neon perceptron: XOR edition\"\ndescription: \"A 4-input, 3-hidden, 2-output mini perceptron that solves diagonal XOR---with an interactive 3D digital twin to play with.\"\ntags:\n - ai\n - web\n---\n\nimport MiniPerceptron from \"@/components/svelte/MiniPerceptron.svelte\";\n\nThe [neon perceptron](/blog/2025/12/11/neon-perceptron-digital-twin/) is coming\nalong, but before we (Brendan Traw and I) commit to the full 5×5 input build\nwith custom PCBs and nine hidden neurons and seven-segment displays, we're\nbuilding a smaller one first. A 4-input, 3-hidden, 2-output mini version---just\nenough to be interesting, and just small enough that we can actually wire it up\nand debug the thing without losing our minds.\n\nThe framing for this smaller version is\n[XOR](https://en.wikipedia.org/wiki/Exclusive_or), which turns out to be a\npretty nice fit. In 1969, Marvin Minsky and Seymour Papert published\n[_Perceptrons_](https://en.wikipedia.org/wiki/Perceptrons_%28book%29)---a\nmathematical analysis of what\n[Frank Rosenblatt's](https://en.wikipedia.org/wiki/Frank_Rosenblatt)\nsingle-layer perceptron could and couldn't do. The headline result was that a\nsingle-layer perceptron can't compute XOR. It can do AND and OR, but it can't\nlearn to output \"true\" when its inputs _disagree_. The function isn't linearly\nseparable, and that's that. The AI winter ensued, until people figured out that\nadding a non-linear activation function made everything hunky-dory.\n\n## The mini-perceptron setup\n\nThe mini perceptron has a 2×2 input grid---four pixels. The task is diagonal\ndetection: light up one diagonal (top-left and bottom-right) and the network\nshould activate one output; light up the other diagonal (top-right and\nbottom-left) and it should activate the other. This is a 2D XOR problem---the\nnetwork needs to distinguish between the two diagonals, which requires looking\nat the _combination_ of inputs rather than any single pixel.\n\nThe two output nodes represent the two diagonals. Whichever has the higher\nactivation gets a glowing halo---that's the network's answer.\n\nBetween input and output sit three hidden neurons with tanh activation. The\noutput layer uses softmax, so the two outputs sum to 1 and you can read them as\na confidence distribution.\n\n<MiniPerceptron client:only=\"svelte\" />\n\nClick on the 2×2 input grid (the blue squares on the left) to light up pixels\nand watch the activations flow through the network. The coloured wires show\nwhat's happening: orange for positive activations, blue for negative, with\nbrightness and thickness indicating magnitude. Use \"Reset\" to clear the inputs\nand \"Randomise\" to generate a new set of weights (as per the\n[previous post](/blog/2025/12/11/neon-perceptron-digital-twin/) these web\nversions don't actually train the model, they're just to get a sense of how the\napparatus'll look). The wire gamma slider adjusts how visible weak connections\nare. You can orbit the camera by dragging on the background, and scroll to zoom.\n\nThe network has 12 weights from input to hidden (4×3) and 6 from hidden to\noutput (3×2). That's 18 weights total.\n\n## What's next\n\nThis mini version is a prototype for the\n[full neon perceptron](https://github.com/ANUcybernetics/neon-perceptron)---a\nchance to test the physical design (flexible LEDs as wires, potentiometers for\nweights, the overall form factor) before scaling up to the\n[5×5 / 9-hidden / 10-output version](/blog/2025/12/11/neon-perceptron-digital-twin/).\nIf the mini version works and looks good, we'll know the concept holds up. If it\ndoesn't, better to find out with 18 weights than 315.\n",
"createdAt": "2026-05-13T23:14:39.563Z",
"description": "A 4-input, 3-hidden, 2-output mini perceptron that solves diagonal XOR---with an interactive 3D digital twin to play with.",
"path": "/blog/2026/03/03/mini-neon-perceptron-xor-edition",
"publishedAt": "2026-03-03T00:00:00.000Z",
"site": "at://did:plc:tevykrhi4kibtsipzci76d76/site.standard.publication/self",
"tags": [
"ai",
"web"
],
"textContent": "A 4-input, 3-hidden, 2-output mini perceptron that solves diagonal XOR---with an interactive 3D digital twin to play with.",
"title": "Mini neon perceptron: XOR edition"
}