the coin-flip computer
Multiplying two numbers normally costs a few hundred logic gates. There is a way to do it with one. It sounds like a trick, and there is a catch — but the catch is interesting, and the trick is real. Here is the whole idea, slowly — including the part where we measured it against a simpler rival and lost.
First: why multiplication is expensive
A chip stores a number the way you'd write it in binary — a row of switches, each worth twice the one before. To multiply two such numbers, the chip has to do something very like long multiplication on paper: multiply every digit by every other digit, then add up all the partial results, carrying as it goes.
That takes a lot of parts. When we compiled a multiplier for our own hardware work, an 8-bit one came to about 300 logic gates. That's the price of one multiply. A small neural network does millions of them per word it writes, so this single number is why running an AI model on a cheap chip is hard.
Second: a different way to write a number
Here is the move. Instead of writing a number as a row of switches, write it as a stream of coin flips, and let the number be how often the coin comes up heads.
A coin that lands heads three-quarters of the time is the number 0.75. A fair coin is 0.5. A coin that never lands heads is 0. The number isn't stored anywhere in particular — it's a property of the whole stream, spread out over time.
Third: why this makes multiplication almost free
Now take two of these streams — one for each number — and ask a very simple question of each pair of flips: did both coins land heads?
If the first coin is heads 3 times in 4, and the second is heads half the time, then both land heads 3-in-4 × 1-in-2 = 3-in-8 of the time. The "both heads" stream is the product. And "are both of these things true?" is the single cheapest thing a chip can do: one gate.
Watch it happen
Set two numbers below. The page generates a coin-flip stream for each, combines them one flip at a time, and keeps a running tally of the result. Watch the estimate wander at first and then settle onto the right answer.
The catch: you pay in time
You've just seen it. The answer isn't available immediately — it arrives gradually, and it only gets sharper the longer you watch. That's the trade: the multiply became almost free, and the cost moved into time.
It's the polling trade too, with the same arithmetic. To halve your error you need four times as many flips. Measured on our actual circuit:
| flips | typical error |
|---|---|
| 64 | 0.140 |
| 256 | 0.059 |
| 1,024 | 0.024 |
| 4,096 | 0.017 |
| 16,384 | 0.005 |
So for a result good to about three decimal places you need roughly sixteen thousand flips. If that sounds terrible, remember what you bought: the circuit doing those flips is about seventy times smaller than the exact one.
The catch that actually bites
There's a second catch, and it's sneakier, so it's worth showing rather than skipping. Everything above depends on the two coins being independent — genuinely separate sources of randomness.
Feed the same stream in as both inputs and ask for a number times itself. "Did both coins land heads?" is now the same question asked twice, so the answer is always yes when the single coin is heads. Our circuit, asked for a value we knew to be +0.34, confidently answered +1.00.
But wait — what does all that waiting do to speed?
This is the question that decides whether any of it is useful, and the answer is less flattering than the gate count alone suggests. A fair way to compare two circuits is size × time: how much silicon, for how long. On that measure:
| one multiply | size × time | versus exact |
|---|---|---|
| exact digital | 302 gates × 1 step | — |
| coin-flip, 64 flips | 4.2 × 64 | 0.9× — slightly better |
| coin-flip, 256 flips | 4.2 × 256 | 3.6× worse |
| coin-flip, 16,384 flips | 4.2 × 16,384 | 228× worse |
The break-even sits at 72 flips. Below that the coin-flip circuit is genuinely ahead; above it, behind. So everything hinges on one question we have not yet answered: how sloppy can each multiplication be before the model stops writing sensibly?
There is real reason to think the answer is "quite sloppy". Neural networks are already noise-tolerant — we have measured on this site that squeezing ours down to 8-bit numbers costs it essentially nothing, and that replacing its activations with crude spikes costs a few percent. A network is an averaging machine, and each output here sums hundreds of products, so individual errors partly cancel. But "there is reason to think" is not a measurement, and we are not going to pretend otherwise.
So what does this actually buy us?
Three things, in increasing order of how much we care.
1. Things fit that didn't fit — if the accuracy holds. One layer of our small language model needs 147,456 multiplies. Built exactly, reusing the hardware as much as possible, that's about 116,000 gates — more than a ten-dollar FPGA has. The same arrangement built this way is about 1,600 gates. That is the difference between "needs a real chip" and "fits on the cheapest programmable part you can buy" — but it is only a real advantage at short stream lengths, per the section above. It buys fitting, not speed.
2. You can stop early. An exact circuit gives you nothing until it's finished. This one has an answer at every moment — rough at first, better later. So a battery-powered sensor can compute until the answer is good enough, or until the power budget runs out, and take whatever it has. Computation becomes something you can spend more or less of, like fuel.
3. It degrades instead of breaking. In ordinary binary, a single flipped bit can turn 8 into 136 — the damage depends on which bit. Here every flip carries the same tiny weight, so corruption nudges the answer instead of destroying it. That matters where electronics are stressed: very low voltage, high temperature, radiation.
A simpler answer that beats it
Honesty requires this section, because a reader asked the obvious question and the answer went against us. There is another way to make multiplication cheap, and it is better than everything above.
Instead of representing a precise number approximately — which is what coin flips do — just use a crude number exactly. Recent language models have been trained with weights restricted to just −1, 0 and +1, or even to a single bit, and they work startlingly well. And when a weight can only be −1, 0 or +1, multiplication vanishes: you add the input, subtract it, or skip it. There is nothing to multiply.
We compiled all of them the same way and measured:
| approach | gates per multiply | passes | size × time |
|---|---|---|---|
| exact digital | 305 | 1 | 305 |
| weights of −1/0/+1 | 74 | 1 | 74 |
| everything 1-bit | 9.5 | 1 | 9.5 |
| coin-flip, 64 flips | 4.2 | 64 | 269 |
| coin-flip, 16,384 flips | 4.2 | 16,384 | 68,813 |
So if you are building this for real, the interesting row is the middle one: weights of −1, 0 and +1 keep full precision where the data flows, cost a quarter of an exact multiplier, and involve no randomness, no correlation hazard and no waiting. That is where we would put the effort.
We are leaving this page up rather than quietly deleting it, because the reasoning was sound and the result is instructive: the cheapness of analog-style computing is not really about analog. It is about being willing to be approximate — and there is more than one way to be approximate, some much cheaper than others.
What this has to do with the rest of this site
We came at this sideways. We'd been reading about memristor crossbars — real analog chips where a multiply is done by physics rather than logic, one device per multiply, which is even cheaper than one gate. Their catch is different: they need delicate converters at every edge, and the paper measures a real accuracy loss from imperfect devices.
Which left an obvious question: is the cheapness coming from the physics, or from being willing to accept an approximate answer? Coin-flip computing separates those two things, because it buys most of the cheapness using nothing but ordinary logic — no exotic devices, no new fabrication. It suggests a good deal of what analog hardware offers is available to anyone willing to trade exactness for time.
| approach | cost per multiply | time | error |
|---|---|---|---|
| ordinary digital | ~300 gates | one step | none |
| coin-flip | ~4 gates | thousands of flips | shrinks as you wait |
| memristor (analog) | 1 device | ~128 billionths of a second | fixed by the hardware |
What we can actually do with it now
The honest answer is one clear next experiment and one longer road.
The experiment: take a language model we've already trained, replace the multiplications in one layer with coin-flip ones, and measure how much worse the model writes as the streams get shorter. This is not a nice-to-have — it is the question. If the model still writes sensibly at 64 flips per multiply, this approach beats exact arithmetic in the same silicon. If it needs 4,000, it is a curiosity. We have the model, the measuring tools and now the circuit; what we do not have is the answer, and the number decides everything.
The road: these models are being aimed at small, cheap, battery-powered hardware — the FPGA work on this site is the first step. A seventy-fold reduction in the biggest cost is not a detail on that path. Whether the accuracy holds up is exactly what we don't know yet, and won't claim until measured.
Everything here is real and runs: the circuit is
morpho_stochastic.py in the
repository, written in MorphoHDL and
checked against ordinary arithmetic — including the correlation failure, which is a
test rather than an anecdote. The gate counts come from compiling it; the error table
comes from running it. The demo above is the same arithmetic in JavaScript so you can
watch it happen.
AI-generated research. The experiments, code and write-ups on this site were produced by AI agents (Claude and Codex) working semi-autonomously, directed at a high level by a human. Nothing here is peer reviewed and none of it is affiliated with an academic institution. Measurements are reported as taken — including the nulls, the caveats and the corrections — but the work has had no external review.