memristors · kt-ram · ai-hardware · unsupervised-learning · ahah · support-vectors · emulator · open-source
Chapter 5b: Maximizing Noise Margin
An unsupervised AHaH boundary settles where the data points push on the decision line all balance. The nearest points are its support vectors, and the gap they hold open is a noise margin against thermal and read noise.
By Alex Nugent ·
Contents
- Do or do not, there is no try
- The rule can only know three things
- Hebbian explodes, anti-Hebbian decays
- AHaH: Hebbian where you’re unsure, anti-Hebbian where you’re sure
- The swing-state strategy
- Reading the boundary as a balance of forces
- Those balancing points are the support vectors
- It doesn’t optimize — it repairs
- When nothing pushes back
- Where the rule comes from
- The cores do it on their own
- A bit against the bath
- What we found
Chapter 5 drew red lines through the data, counted where they landed, and called the landing spots attractors. We watched a two-kT-bit node fall into one decision boundary or another with no teacher in the loop, and we read those boundaries off as logic gates, without ever asking why a line settles in one place and not another, or why that place is stable enough that a few hundred random nodes drain into a handful of states instead of smearing out across every angle the line could take. That is a question about force: what pushes the boundary, and what holds it once it stops.
Do or do not, there is no try#
In Chapter 5 the node’s output was , with the decision boundary sitting where that output crosses zero, and a boundary picked at random can produce something like this:
The line runs right through [1,1], where the node’s output sits a hair from zero — undecided, neither a confident yes nor a confident no. The truth table has a column that cannot be filled, because the output is so close to the boundary that thermal noise alone could flip its sign on the next read.
Confident logic cannot come from unconfident neurons: a logic gate has to be sure, giving the same answer to the same input every time, even with noise rattling the conductances. The weights need to change in a way that reduces indecision — a synaptic plasticity rule that drives the node off the fence and holds it there.
The rule can only know three things#
Write the weight update as
The update to one synapse is some function of the input on that synapse’s line, the node’s output , and that synapse’s own value — a function of those three things and nothing else, because of locality. A kT-bit is two memristors wired against each other on a lane, with only its own state, the input driving its line, and the voltage the lane reads out physically available to it. There is no global error signal piped in from outside, no optimizer holding the whole dataset in memory. Everything that moves the weight has to be local to the weight. That sounds like a restriction — a useful one that throws out every rule we could write on paper but never build, leaving a short list.
Hebbian explodes, anti-Hebbian decays#
The oldest guess is Hebbian: neurons that fire together wire together.
Pushing the weight in the direction the node already leans has a fatal problem: start a synapse a hair positive, read it, and it reads positive; reinforce it, and it reads more positive; reinforce again, and you are on a positive feedback loop that runs the weight to infinity. Hebbian learning alone is a microphone next to its own speaker.
The fix that suggests itself is the opposite move, anti-Hebbian:
Pushing the weight against the output removes the runaway, but trades it for a different kind of useless: the weight decays toward zero and sits there. Anti-Hebbian alone walks every node back to the fence we were trying to escape.
One explodes, the other collapses; combined, they fix each other.
AHaH: Hebbian where you’re unsure, anti-Hebbian where you’re sure#
where is the step function, whose sign is the sign of the output. This is the unsupervised AHaH rule, the Hebbian and anti-Hebbian halves of the FF-RU cycle from Chapter 5 written as one line — watch how the balance between the two terms shifts with .
When is near zero — the node is unsure — the Hebbian term wins and the update is large, so an undecided node gets shoved hard toward a decision. As the node commits and grows, the anti-Hebbian term catches up, the update shrinks, and at some magnitude the two terms cancel and the weight stops. The weight grows fast at first, then slows, then holds at an equilibrium — a wedge that drives the node off zero and pins it on one side.
Small activations get large updates, large activations get small ones. The rule spends almost all of its effort on the patterns the node is least sure about, and barely touches the ones it already answers with confidence. That move has a name in machine learning, margin maximization, and a more physical one on hardware: the node putting distance between its decisions and the noise that could flip them.
The swing-state strategy#
The same accounting shows up in a national election, where a campaign with a fixed pile of money for advertising has to decide where it goes.
A dollar spent on states that already vote your way by forty points changes nothing, since those are already in the bag, and a dollar spent on states you will lose by forty is just as wasted; everything goes to the handful of close states, where a push actually moves the result. The AHaH rule does the same accounting on data: patterns the node already answers with conviction get almost no update, while the close ones — the swing patterns near the boundary — get all of it. A node and a campaign run the same strategy because they face the same problem — a finite budget against a decision that only a few undecided cases will settle.
Reading the boundary as a balance of forces#
Think of the decision boundary as a physical thing that each data point pushes on: when a pattern lands on the wrong side of the line, or too close to it, the AHaH update shoves the line away from that pattern, and the push grows stronger the closer the line gets.
Pattern [1,1] pushes the line with a force we can call , [0,1] pushes with , [1,0] with . Move the boundary away from [1,1] and drops off — but the line has moved toward [0,1], so grows and pushes back. Somewhere between them the two forces cancel, and the boundary stops. That balance point is the attractor. If you like algebra, write out the weight update for each pattern, sum them, set the sum to zero, and solve — the attractor is the root. If you like pictures, it is the place where the line is wedged between two opposing groups of data, pushed equally from both sides, with nowhere left to drift.
This force balance explains why the boundaries in Chapter 5 settled where they did, and why they were stable: a boundary off the balance point feels a net force back toward it, and an attractor exists anywhere the data splits cleanly into two groups, because that gap is exactly where the opposing pushes can cancel.
Those balancing points are the support vectors#
Look at what is doing the pushing when the line comes to rest: patterns far from the boundary push with almost nothing, the locked states, the forty-point landslides. The patterns near the boundary are the ones still pushing hard at equilibrium, holding the line in place — they set where it sits, and moving one of them moves the boundary with it, while the distant points could shuffle around freely and change nothing.
A machine-learning engineer has a name for the handful of nearest points that pin a boundary: the support vectors . The empty gap the boundary keeps between itself and those nearest points has a name too — the margin. A line sitting in the middle of the widest gap it can find between the two classes is a maximum-margin classifier, and the points touching the edges of that gap are its support vectors. They are the only data that matters — throw the rest away and the boundary comes out the same — and the fewer of them it takes to hold the line, the more trustworthy it is: a support vector machine’s error is bounded by the share of the data that ends up as support vectors.
That margin is a noise margin. Digital logic has used the term for decades — the slack between a valid 1 and a valid 0, the buffer that lets a gate shrug off noise on its inputs and still read the right bit. The AHaH margin is the same buffer. The distance from the boundary to the nearest pattern is the smallest output the node ever produces on real data, and that smallest output is exactly what thermal and read noise have to overcome to flip an answer. Widening the margin moves every decision further from zero, maximizing the node’s immunity to its own noise — a significant detail on a kT-bit built from two jittering memristors. It is the problem we opened with — a pattern sitting on the line, one noisy read from flipping. The rule’s solution is to drive every pattern as far from the line as the data allows.
For about fifteen years, from the mid-1990s until deep learning took over around 2012, the support vector machine was the best general-purpose classifier going, and it came with something rare in machine learning — a clean theory of why it works. A model can always draw a boundary that wiggles through every training point exactly, and that is memorization: it has fit the noise, and it generalizes terribly. The widest-margin cut does the opposite. It commits to the simplest split with the most room to spare on either side, and Vapnik’s statistical learning theory showed that the wider the margin, the better the classifier does on data it has never seen — no matter how many dimensions the data has. Maximize the margin and you trade memorization for generalization. That result remains the clearest account we have of the difference between the two.
A wide margin also makes the classifier robust: its answer holds still when you jiggle the inputs, and that robustness is what generalization is. Thermal noise on a read and a never-seen test point are the same kind of jiggle, so the margin that survives is the margin that generalizes — noise immunity and generalization are one claim seen twice.
It doesn’t optimize — it repairs#
A support vector machine solves that global optimization once, over the whole labelled dataset, and returns the single best boundary; unsupervised AHaH does not. Turned loose from a random start, a node falls into one of many attractors — Chapter 5 counted them and handed them names — landing wherever its starting point sends it, not in the best one. Every attractor is a clean separation that maximizes its own margin, the boundary wedged in the gap between whichever patterns its basin happened to sort onto opposite sides. The rule maximizes the margin of the boundary it is already near, never searching for the best one; the support vectors are never computed either, just whatever patterns are still pushing when the boundary stops moving.
Holding a boundary once one is there turns out to be worth just as much: because every max-margin separation is a physical attractor — an actual low point the dynamics fall toward — a classifier placed on one becomes self-correcting. Train the state however you like, supervised, even with a full support vector machine, to drop it into the exact basin you want. Then hand it to unsupervised AHaH and leave it running. Damage the weights, lose a device, let the conductances drift the way real memristors do, and the same read-then-reinforce loop — local and online, each kT-bit seeing only its own state and the lane’s output — drags the boundary back to the attractor it was sitting in. The damage is a shove off the balance point; the forces that set the balance point shove right back.
This is what vanilla AHaH plasticity does — the bare FF-RU cycle, nothing bolted on. It does not optimize a classifier. It takes a separation between opposing states and makes it stable, turning a maximum-margin boundary — the seminal SVM result, the cleanest line we have between memorization and generalization — into a stable equilibrium of the physics. Place a classifier on that equilibrium and it holds itself there with no teacher and no supervision running, repairing the state as the conductances drift and devices fail.
So far, one lane, understood from the inside: how FF-RU plasticity moves a boundary, why it settles, what it settles into. The next step is to put it to work — wire many lanes together, bring in the rest of the kT-RAM instruction set, and build a supervised classifier instead of only stabilizing one. That is where we go next.
When nothing pushes back#
That picture also explains the state we kept hitting in Chapter 5 and could not get rid of — the null state, where the node answers every pattern the same way. It is what happens when there is no opposing force. If every data point sits on one side of the line, every push points the same direction, nothing cancels them, and the boundary just slides until the weights hit the rail. The node ends up declaring everything positive, or everything negative.
The null state is the rule reporting a fact about the data: as encoded, it gave the node nothing to separate, no two groups with a gap between them, no balance point to find. Chapter 5 showed the three ways out, and now they read as three ways to manufacture an opposing force: encode the inputs sparsely so patterns land on both sides, add RA bias synapses that push back against the majority, or be careful with the Hebbian term so the rich do not always get richer — each one a way of making sure something pushes the other way.
Where the rule comes from#
None of this update is arbitrary — the AHaH rule can be derived instead of guessed. Ask for a node whose output is as bimodal as possible — a clean lump of positive answers and a clean lump of negative ones, with as little mush in the middle as you can manage. That is the no-mumbling condition stated as a statistic, and the statistic that measures it is kurtosis. Minimizing a kurtosis objective over the node’s output is one of the standard routes to independent component analysis , the problem of pulling a mixed datastream apart into its independent pieces. Run that derivation and a plasticity rule drops out:
The exact curve differs from the step-function version, but the two trends are the same: as grows the update first shrinks and then turns anti-Hebbian. Small activations get pushed hard, large ones get left alone. The election strategy and the ICA objective are the same rule seen from two directions — one says spend where it matters, the other says make the output bimodal, and they land on the same curve.
The cores do it on their own#
Testing whether the hardware obeys this rule means running the unsupervised cycle on a batch of emulated cores, recording every weight update against the output that caused it, and plotting versus .
No two cores draw the same curve. The float is smooth, the byte moves in 8-bit steps, and the two physical models, RS and MSS, are stochastic and scattered. The ideal float and byte stay Hebbian and just taper off as the node commits; the physical devices, pushed past their balance point, cross into the anti-Hebbian pull-back that pins the equilibrium — the full wedge from the diagram above, rendered in real device physics. Every one agrees on what matters, though: the biggest updates land where the node is least sure, near — nobody programmed the AHaH rule into these cores, we wired two memristors against each other, ran the read-then-reinforce cycle, and the rule is what came out.
A bit against the bath#
Go back to the name: a kT-bit is named for , the thermal energy of the bath it sits in — the jitter that nearly flipped [1,1] in the opening figure. The margin is the wall against it, and a state is a bit only while that wall stands above ; drop it below the noise and the read flips at random, so the state no longer stores a reliable bit. The margin is what makes a state a bit at all — maximize it and you dig the well deep enough to hold a bit against the bath.
Chapter 3b built that wall one bit at a time: a single pair reads clean only when it is polarized and full of evidence, and as the weight difference and magnitude grow, the signal climbs above the noise floor — balanced and light, the read is mostly noise. The AHaH rule does the same thing across a lane, steered by the data: it reads the structure in the inputs, drives each pair off the balance point, and grows the lean the input structure sets, and that growing lean is the margin. Margin maximization is barrier-building run across a whole node, growing the wall the physics already offers rather than fighting the noise directly.
What we found#
The attractors from Chapter 5 are not arbitrary resting places. Each input pattern pushes the decision boundary away from itself, the push gets stronger as the boundary comes closer, and the boundary settles where the opposing pushes cancel — wedged in the gap between two groups of data, equidistant from the nearest patterns on either side. Those nearest patterns are the support vectors, and each kT-bit settles among them using only what is local to it — no teacher, no global solver. The rule does not search the many possible boundaries for the best one; it maximizes the margin of whichever boundary its basin drops it onto, holds it there as a matter of physics, and repairs it when damage knocks it loose. That margin is a noise margin — the boundary sits as far from the nearest patterns as the data allows, leaving the most room it can between every decision and the noise that would flip it. When the data offers no opposing group, there is nothing to balance against, and the node slides into the null state.
Feed a lane structureless noise and there are no opposing groups to wedge a boundary between, so no clean attractors form. Feed it structured data and every clean split in that data is a place the pushes can cancel — a place a boundary will come to rest and a logic gate will assemble itself. The force field the boundary settles into is the structure of the data. The data carries the blueprint for its own gates, and the AHaH rule is the hand that reads it.
Next: Chapter 6: Classification and Thermal Sampling on kT-RAM Neural Lanes