Part V Chapter 22

Experiments on generated chips

Contents
  1. The experiment
  2. No mask: at once
  3. Two shares: the wait grows with the noise
  4. Three shares: mostly nothing
  5. Bit-weighted leakage: no parity
  6. Masking with addition
  7. What it doesn’t do
  8. What next?

Chapter 18 ended Part 4 with questions the real datasets couldn’t answer, because each of them is one chip with one noise level and one kind of masking. Does every masked chip produce a plateau and a jump, or only some? ESHARD’s network stayed at the easy step; was that the noise? And the paper suggests masking in a prime field, where the rule that makes parity easy breaks: does that stop a network from learning, or only slow it down?

With the generator of Chapter 20 each question becomes a set of chips that differ in one setting, and with the detector of Chapter 19 each training curve gets the same reading without anyone looking at it.

The experiment

The network and training are those of Chapter 11, with 50,000 training traces, now for 60 epochs. The chips vary in three settings:

  • Noise: 0.05, 0.1, 0.2, 0.3 (the default), 0.45 and 0.6.
  • Shares: one (no masking: the chip handles the secret value itself), two, or three, combined with XOR.
  • Leakage: the Hamming weight of each byte, or a weighted sum of its bits.

That is 36 chips, each trained from three random starts: 108 networks. For each run we record the best perceived information on the test traces, and how the network got there. It learned at once if it had half of its best by the end of the first epoch, or in a jump that started by epoch 2. It waited if half of its best came in a single jump the detector marks later; the wait is the number of epochs before that jump. It learned nothing if it never got above 0.02 bits.

How the network learns, by noise, shares and leakageleaks the Hamming weightno mask2.56at once2.56at once2.47at once2.11at once1.59at once1.24at once2 shares1.15at once1.15wait 20.96wait 40.47wait 90.09no parity0.07no parity3 shares0.981 of 3nothingnothingnothingnothingnothing0.050.10.20.30.450.6noiseleaks weighted bitsno mask1.61at once1.56at once1.46at once1.34at once1.14at once0.96at once2 shares0.23no parity0.20no parity0.14no parity0.11no parity0.09no parity0.07no parity3 sharesnothingnothingnothingnothingnothingnothing0.050.10.20.30.450.6noise
For each generated chip, the best perceived information on the test traces in 60 epochs (median of three seeds; for the chip where only one seed learned, that seed’s), and how the network got there. At once: half of it by epoch 1, or in a jump starting by epoch 2. Wait N: half of it in one jump, after N epochs of plateau (median of the seeds). No parity: two shares, and less than 0.1 bits of parity. 1 of 3: only one seed learned anything. Nothing: under 0.02 bits in every epoch, every seed.

No mask: at once

Without masking, the network learns at once at every noise level and with both kinds of leakage, with 87% to 94% of its best after the first epoch. With Hamming-weight leakage at the lowest noise it reaches 2.56 bits, everything the test labels hold. With bit-weighted leakage it tops out at 1.6 bits even at the lowest noise, because the pulse doesn’t follow the Hamming weight.

So the plateau isn’t something this network does on any chip. It comes with the masking.

Two shares: the wait grows with the noise

With two shares and Hamming-weight leakage the network can learn all there is to learn from the two weights: 1.15 bits at noise 0.05 and 0.1, exactly what Chapter 11 computed for two weights read perfectly. How it gets there depends on the noise:

NoiseWait before the jump (three seeds)Best perceived informationBest possible parity guess
0.050, 0, 1 epochs1.15 bits100%
0.10, 2, 31.14–1.15100%
0.23, 4, 40.95–0.9697%
0.36, 9, 90.4781%
0.45no second step0.0960%
0.6no second step0.0753%

The last column is the best possible accuracy on the label’s parity from the two share cycles, the ceiling of Chapter 20. As it shrinks from 100% to 81%, the wait grows from nothing to nine epochs. At 60% the second step never comes, not in 60 epochs and not in 200: we trained the three networks at noise 0.45 for 200 epochs, and parity information stayed at zero while perceived information on the test traces fell to between −0.05 and 0.01 bits, and on the training traces rose to about 0.25. Instead of learning parity, they memorized.

This fits the two-piece model of Chapter 11, where the wait grows as the pieces start smaller and pay off less: the noisier the readings of the two weights, the less parity built on them is worth, and the longer the network takes to start building it. Past some point it doesn’t start at all within any training we tried.

It also answers Chapter 18’s question about ESHARD. A network on a chip with two Hamming-weight shares and enough noise stays at the easy step, high versus low, and that is what ESHARD’s network did. That doesn’t prove noise is the reason on ESHARD, a different chip and network, but noise alone is enough to produce the same behaviour.

chip leaks
How the network learns on each generated chipno maskat onceat onceat onceat onceat onceat once2 sharesat oncewait 2wait 4wait 9no parityno parity3 shares1 of 3nothingnothingnothingnothingnothing0.050.10.20.30.450.6noise00.20.41204060epoch; perceived information, three seeds

2 shares, Hamming-weight leakage, noise 0.3. Best perceived information of the three seeds: 0.47, 0.47, 0.47 bits. It waits about 9 epochs, then jumps. Parity at epoch 60: 0.31, 0.33, 0.31 bits.

Three shares: mostly nothing

With three shares, 17 of the 18 runs learned nothing in 60 epochs. The exception is one run at the lowest noise: it sat at zero for 20 epochs, then jumped in epochs 21 to 27 to 0.98 bits, almost all of it parity, and reached 0.99 bits by epoch 200. The other two runs at that noise, and all three at noise 0.1, still had nothing after 200 epochs.

So at low enough noise three shares can be learned by this network, and when they are, it is in a jump after a long plateau, longer than for two shares at any noise. But two of three starts never got there, and at noise 0.1 none did. With three shares, whether the jump comes at all depended on the random start more than on the chip, and a curve that is still flat after 200 epochs doesn’t say the chip is safe: the same chip, trained from another start, may be broken.

Bit-weighted leakage: no parity

With bit-weighted leakage and two shares, the network never learns parity (at most 0.016 bits of it, in any run), as the ceiling of Chapter 20 predicted. It learns 0.07 to 0.23 bits depending on the noise, in a gradual rise or a small first step, with no plateau and no jump. With three shares it learns nothing.

Masking with addition

The paper suggests masking in a prime field, where shares add up modulo a prime instead of being XORed. We trained the same network on chips whose two shares add up modulo 256 or modulo 257, with Hamming-weight leakage, at the four lowest noise levels, three seeds each:

NoiseXORAddition mod 256Addition mod 257
0.051.15 bits0.11–0.120.11
0.11.14–1.150.10–0.110.09–0.11
0.20.95–0.960.080.08
0.30.470.060.05–0.06

Addition doesn’t slow the network down: there is no plateau, and about three quarters of what it learns is there by epoch 10. It limits what there is to learn. With addition, the exact Hamming weights of the two shares say only 0.14 bits about the label’s weight (0.13 modulo 257), against 1.15 with XOR: carries scramble the relation between the weights of the shares and the weight of their sum. At the lowest noise the network gets 0.11 to 0.12 of those 0.14 bits modulo 256, and 0.11 of the 0.13 modulo 257.

On a chip that leaks Hamming weights, then, masking by addition doesn’t merely make the network’s job harder; it removes most of what the weights can say. Whether the modulus is prime makes no difference here. A chip that leaks more than the weight of each share, every bit separately for instance, would leave more to learn, and this experiment doesn’t test that.

What it doesn’t do

Everything here is one network and one recipe: Chapter 11’s four layers of 40 neurons, 50,000 traces, the same learning rate and weight penalty. A larger network, more traces, or another optimizer could move every boundary in the map. Three seeds per chip show how much starts differ, but not the odds precisely.

The noise levels are six points, so where exactly the second step stops arriving, between 0.3 and 0.45, isn’t pinned down.

And the chips are simulations, with the limits listed in Chapter 20.

What next?

All of Part 5 ran on simulated chips. The last step is a real one: recording traces from a board on a desk, with masks we chose, and running the whole pipeline on them. Chapter 23 will do that.