{"slug": "embedding-boolean-circuits-in-a-neural-network", "title": "Embedding boolean circuits in a neural network", "summary": "A blog post on Robot Book Club lays out a method for installing a boolean circuit as a sidecar to an already-trained neural network, splitting the problem into representing boolean gates as neurons and wiring that circuit into the trained model. The post gives neuron formulas for AND (A + B - 1.5 > 0), OR (A + B - 0.5 > 0) and NOT (0.5 - A > 0), and defines a \"Probe\" that maps a real-valued neuron such as L3 N234 into a boolean signal and a \"Stim\" that adds a signed steering magnitude, such as -12.5 on L11 N15292, back into the residual stream. The author notes the probe must run before the layer it stimulates within a single forward pass and published no code, describing the post as structuring thinking for a larger project.", "body_md": "[Robot Book Club](https://edwardbenson.com/robot-book-club).\n\nThis post is mostly me thinking out loud: how is it possible to install a boolean circuit sidecar to an otherwise trained neural network?\n\nIt strikes me that there are essentially two distinct problems here:\n\n- Representing the boolean circuit as a set of neurons\n- Connecting the boolean circuit to a trained network\n\nThe representation part is relatively straightforward. A neuron is a weighted sum of inputs, plus a bias, passed through an activation function.\n\nIf we assert that the inputs are all either 0 or 1, and the activation function is simply “is it greater than zero”, then we can turn boolean operators into neurons like so:\n\n```\nAND(A, B) = A + B - 1.5 > 0\nOR(A, B) = A + B - 0.5 > 0\nNOT(A) = 0.5 - A > 0\n```\n\nThere’s no extra story needed here with respect to boolean expressions. These gates are all you need to create any expression, and the neurons can compose exactly as the symbolic operators would compose on paper.\n\nThe second problem is patching this circuit to a trained network. Signals in a trained neural network aren’t necessarily a clean 0 or 1 depending on where you draw them from.\n\nSo you need an ingress and egress mapping: from the neural net into the boolean circuit, and then back into the neural net. Kind of like Neuralink but for LLMs.\n\nFor the ingress side, let’s call a `Probe` a mapping from a trained neuron with real-valued output into a boolean-valued signal.\nWe’ll notate a probe like this:\n\n```\nprobe Trigger: [L3 N234 >1]\n```\n\nThis probe would be 0 if neuron `L3 N234` was equal to or less than 1, and 1 otherwise.\nIt can be implemented with a single neuron at the ingress of the boolean circuit, with a threshold set based on knowledge of the targeted neuron and observed meaning of it firing under different values.\n\nFor the egress side, let’s call a `Stim` an additive push that a boolean value switches on or off.\nA stim identifies a neuron and a signed steering magnitude.\n\n```\nstim Watermelon: [L11 N15292 -12.5]\n```\n\nHere `-12.5` sets the direction and size of the added push.\nThis size value has to be chosen based on the observed and desired effect in the trained LLM.\nFor example, if you found a neuron that made the model act like a watermelon when pushed at -12.5, then you might connect this `stim` as the output of some boolean circuit intended to switch it on at the right time.\n\nAn individual MLP neuron has a scalar activation. In a transformer, its output weights define a direction in the vector-valued residual stream. Here, a stim adds the stated signed magnitude along that direction, normalized to length 1.\n\nWithin one forward pass, the probe must run before the location it stimulates, as in the L3-to-L11 example above. Reading a later layer and stimulating an earlier one requires carrying the signal into a subsequent processing step.\n\nAnd that’s it!\n\nI’m fairly certain this describes:\n\n- A method of translating a boolean expression into a neural circuit\n- A method of adapting real-valued neurons into boolean-valued inputs for this circuit\n- A method of adapting boolean-valued outputs of this circuit back into real-valued outputs in the network\n\nNo code example attached this time. I’m using this blog post to structure my thinking for something slightly more involved I’m hacking on.", "url": "https://wpnews.pro/news/embedding-boolean-circuits-in-a-neural-network", "canonical_source": "https://edwardbenson.com/2026/10/embedding-boolean-circuits-in-a-neural-network", "published_at": "2026-11-01 15:27:44+00:00", "updated_at": "2026-11-01 15:49:53.923260+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "neural-networks", "large-language-models", "ai-research"], "entities": ["Robot Book Club"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/embedding-boolean-circuits-in-a-neural-network", "markdown": "https://wpnews.pro/news/embedding-boolean-circuits-in-a-neural-network.md", "text": "https://wpnews.pro/news/embedding-boolean-circuits-in-a-neural-network.txt", "jsonld": "https://wpnews.pro/news/embedding-boolean-circuits-in-a-neural-network.jsonld"}}