Part V Chapter 19
Detecting jumps automatically
Contents
Every jump in this guide so far was found by looking at a curve. Chapter 11 saw the toy chip’s network climb between epochs 9 and 13, Chapter 16 took CHES_CTF’s jump at epochs 77 to 85 from the paper, and Chapter 18 argued that the jumps are what tells an evaluator when to look inside a network. An evaluator with dozens of networks can’t look at every curve, and two people looking at the same curve don’t always agree where a jump starts.
This chapter writes a program that finds them, and then asks how we would know it’s right.
What a jump is, in numbers
Chapter 11 described a jump as a sharp rise in a few epochs between two flatter stretches. A program needs three numbers in that sentence: sharp compared to what, rise to where, and how much.
Sharp compared to the curve’s own wobble. Perceived information moves a little from one epoch to the next even when the network learns nothing new, and how much depends on the curve and on the stage of training. So the detector estimates that noise locally, from the changes between consecutive epochs in a window of 7 epochs on each side, using medians rather than averages so that a jump inside the window doesn’t inflate it. On CHES_CTF it comes out at 0.016 bits around epoch 50 and 0.054 around epoch 120. Every threshold below is in units of this local noise.
Rise to where: above anything in the previous 10 epochs. Chapter 10 showed that perceived information can drop for an epoch and come back, when the network is briefly too sure of its wrong answers. The climb back from such a dip is fast, but it isn’t a jump.
How much: a jump climbs at least 1.5 noise units per epoch, and gains at least 3 noise units in total.
Applied to the raw curve, these rules mark noise: any epoch that happens to sit high looks like a fast climb. So the detector first simplifies the curve.
Step one: straight pieces
The detector draws the curve as a series of straight pieces, each fitted to its epochs by least squares, with the error measured in noise units. More pieces always fit better, so each piece has a price, the penalty, and the detector picks the split with the lowest error plus price. Finding the best split sounds like a search over every way to cut the curve, but it can be done exactly and quickly: the best split up to epoch j is the best split up to some earlier epoch i, plus one piece from i to j. Working forward from epoch 1, each epoch only has to try every possible start for its last piece. For 200 epochs that is about 20,000 candidate pieces, done in a moment. The widget runs the same code:
At the lowest penalty CHES_CTF splits into 56 pieces, most of them following noise. At 8, the default, it splits into six: the first 14 epochs, the slow rise and the plateau up to epoch 77, the jump, the long noisy stretch after it, a second stretch after the deep dip at epoch 166, and the last two epochs, where the curve falls again. At 64 only two remain. The jump survives every setting: epochs 77 to 81, or 76 to 81 at penalty 2, and only the steepest part, 80 to 81, from penalty 16 up.
Step two: marking the jumps
On the simplified curve the rules of the first section apply directly. The detector marks every epoch where the fitted line climbs at least 1.5 noise units to a new high, joins marked epochs that are at most two epochs apart, and keeps a run if it gains at least 3 noise units over the previous high.
On CHES_CTF that leaves one jump, epochs 77 to 81, gaining 0.58 bits. Perceived information goes from 0.14 at epoch 77 to 0.61 at epoch 81, with a dip to 0.17 at epoch 80 that the two-epoch rule bridges. By epoch 85, where the paper’s band ends, it has reached 0.70; the detector stops at 81 because the four epochs after it climb by less than one noise unit each.
The slow rise of epochs 10 to 40 isn’t marked. It gains less than 0.1 bits over 30 epochs, a small fraction of the noise per epoch, and fast is part of the definition. Something that slow needs a rule of its own.
Curves where the answer is known
The real curves can’t tell us whether the detector is right, only whether it agrees with the paper’s eye. To measure it, we made curves where the answer is known: 100 epochs of random noise of size 1, plus a rise of 6 or 12 noise units spread over 1 or 4 epochs, placed at random. That gives 400 curves with one jump each. Against them, 300 decoys with none: pure noise; noise on a slow rise of 12 over 60 epochs; and a jump followed by four dips of two epochs, each 60% of its height, whose recoveries shouldn’t count.
A jump counts as found if a marked run lies within two epochs of it; anything else marked is a false jump. To see what the straight pieces add, the same count runs on a baseline that replaces step one with the obvious alternative: smoothing the curve with a weighted moving average (a Gaussian 1.5 epochs wide), then the same marking rules, with the noise scaled down by the smoothing. Both have a threshold that trades found jumps for false ones, so each is shown at several:
At its default threshold the detector finds 98% of the jumps with 0.10 false jumps per curve. At about the same rate of false jumps, 0.12, the baseline finds 93%; to find 99% it needs 0.37. Both place the edges of a jump within about an epoch. The penalty of 8 and the threshold of 1.5 were chosen on these curves, and stay fixed for everything below.
Gradual rises are the weak spot. Spread over 8 epochs, a rise is found between 74% and 96% of the time depending on its height: when it is that gradual, the detector sometimes draws it as a sloped piece too shallow to count.
The toy chip: checking against what was learned
On the toy chip we can do better than compare with an eye. Chapter 12 measured, from the network’s outputs at every epoch, how much it knows about high versus low weights and how much about even versus odd. The first is learned early and the second at the jump. Here are the five runs of Chapter 11, with the epoch at which each kind of information reaches half its final value:
| run | detector | baseline | high or low, half-way | even or odd, half-way |
|---|---|---|---|---|
| 1 | 1–4, 10–16 | 1–5, 8–16 | 1 | 13 |
| 2 | 1–2, 7–10 | 1–13 | 2 | 9 |
| 3 | 1–2, 10–14 | 1–4, 7–16 | 2 | 13 |
| 4 | 1–3, 10–15 | 1–4, 7–16 | 1 | 11 |
| 5 | 1–4, 11–12 | 1–15 | 2 | 12 |
The detector finds two steps in every run. The first always contains the epoch where high-or-low information is half-way, and the second the epoch where parity is half-way. The baseline merges both steps into one in two of the five runs.
How firm is each answer? The curve is computed on 5,000 test traces, and a different 5,000 would give a slightly different curve. Resampling the traces 200 times and running the detector on each, the second step is found again as a jump of its own in 99%, 56%, 100%, 100% and 94% of the resamples. Run 2 is the fragile one: its jump comes earliest, at epochs 7 to 10, and the resampled curves often run it together with the first step.
The three chips
On ESHARD the detector marks epochs 1 to 5, gaining 0.066 bits. The paper’s jump at epoch 4 is inside, but the start is too early: perceived information sits at −0.01 for three epochs and then climbs, and with so few epochs before the climb the detector draws a single sloped piece through epochs 1 to 4. Resampling the 10,000 attack traces 200 times, it finds the jump 99% of the time, always within epochs 1 to 9.
On CHES_CTF it finds epochs 77 to 81 in every resample, always within 76 to 81.
On ASCADr it finds nothing, and that is correct. Chapter 17 showed that perceived information of the published checkpoints never rises: it falls from epoch 8 on. There is no jump in that curve to find. The network does learn, though, and Chapter 17 saw it in another number: the average probability it gives the true value, which rises from 1/256 to about 0.01. Fed that instead, as log2 of 256 times the average so that a network that knows nothing scores 0, the detector marks epochs 6 to 21, in every resample, starting at epoch 6 or 7 and ending between 20 and 22. Chapter 17’s probes saw the network learn the input bits between epochs 7 and 13 and the output bits between 13 and 22; the detector sees the two as one continuous rise. The perceived information saved in the authors’ notebook gives the same answer, epochs 7 to 22.
The detector finds what the curve shows, and the choice of curve is part of the method. Perceived information is the natural choice, but on ASCADr’s published checkpoints it hides the learning that the average probability shows.
What it doesn’t do
It says when, not what. A marked jump is where to look; Chapters 12 to 14 are how to look.
Its edges are fuzzy by an epoch or two, and more when a jump comes right at the start of training, as on ESHARD, where there is little curve before it to measure the noise.
It can’t always tell one step from two. ASCADr’s input and output bits arrive as one rise, and on the toy chip a jump that follows the first step closely is found as its own jump only about half the time.
Resampling the traces measures only one source of uncertainty. Training the same network again from another random start moves the jump by several epochs, from 9 to 13 on the toy chip, and no detector run on one curve can know that.
What next?
Everything above ran on networks someone else trained, or on one simulated chip. To test the detector, and everything that comes after it, on many chips where the truth is known, we need chips we can make ourselves, with the noise, the masking and the leakage chosen in advance. How do we build them? Chapter 20 does.