Week 3 — The Perceptron and the Space of Interactions
Notes for the neural-networks course, Unit 1. Written by an AI assistant under the researcher’s supervision; see ai-authorship.
We need an adjustable map from input numbers to prediction scores. A single neuron is the smallest example. We will calculate its output and one training step, compose neurons into a hidden layer, and then ask how many prescribed labels a weight vector can represent. The last question leads to Cover’s counting formula and the statistical mechanics of learning.
Learning goals
- Compute what a neuron outputs and carry out one weight update by hand.
- Distinguish finding a solution from counting the solutions, and say why the second question is the one statistical mechanics answers.
- Derive Cover’s counting formula and its threshold .
- State what the threshold does and does not claim.
Reading
Primary text. Chapter 2, §2.1 through §2.3.
Primary literature, through the bibliography: Cover (1965) for the counting; Engel and Van den Broeck (2001) for the statistical-mechanical framing that Week 4 takes up.
Prerequisites. Weeks 1–2. Quenched disorder at the level of “the couplings are drawn once and held fixed”; the rest is developed here.
1. A neuron, and one update
A neuron is a small adjustable function. Given numbers , form
The weights specify how strongly each input contributes. The bias is an additive offset. An activation function turns this field into an output . With the output is a class label, and the boundary is a hyperplane normal to . With the output varies smoothly.
To predict a binary label , use the Week 1 distribution
The loss depends on a weight through the field. The chain rule gives
The predicted mean is and the observed label is . The factor tells how much changing that weight changes the field.
Example. Hold and fixed. Initially , so . With learning rate , the update gives
Thus and the loss falls from to nats. This establishes improvement on this observation; performance on fresh inputs requires another test.
A hidden layer and backpropagation
A layer is a collection of neurons acting on the same input. It is hidden if its outputs are intermediate quantities rather than the final prediction. Let
Use in place of in the binary distribution. Put . The derivatives are
Read the third expression along its path: a weight changes by , changes by , and changes by . Backpropagation organizes these chain-rule products from the final loss back toward the inputs, reusing derivatives shared by several paths. It does not require a new rule of calculus. The nonlinear activation matters: composing only affine maps would still give a single affine map.
The vocabulary of neurons and layers is now fully specified by equations. Week 8 will use this same hidden-layer construction separately at each text position.
2. From finding to counting
The change of question happens here, and it should be marked in the lecture.
Fix patterns and desired labels. The learning question is: does some algorithm reach a weight vector that classifies them all? The feasibility question is: does such a weight vector exist, and what fraction of weight space consists of them? The second question has no algorithm in it.
The book sets it up on the homogeneous spherical perceptron, with the norm fixed by . Fixing the norm is not cosmetic: at zero margin it removes a scaling redundancy, and once a nonzero margin is demanded it is essential, since otherwise every field could be inflated by rescaling the weights. The factor in the normalized field is derived rather than asserted — the field is a sum of independent contributions with variance , so it grows like , and dividing leaves a quantity against which a fixed means the same thing at every dimension.
Write the normalized field for pattern as
Here is an input vector and its desired sign. A margin requires , providing a buffer against the decision boundary. With the normalized uniform measure on , Gardner’s volume is
The step function is one when a constraint is satisfied and zero otherwise; the product keeps only weights satisfying them all. Thus is the fraction of the sphere meeting every constraint. The patterns are quenched disorder: drawn once and held fixed while the weight configurations are examined. The ratio is the load, and it is the same the course uses in Weeks 4, 5 and 13.
Physical picture. The quenched setup is the familiar one, and naming it as such saves a lot of confusion later. The patterns play the role the random couplings play in a spin glass: they are part of the problem, not part of the state, and an observable must be averaged over them after the thermodynamics is done, not before. The weight vector is the state, the sphere is its configuration space, and the constraints carve a region out of it. Everything in Weeks 3 and 4 is an attempt to measure that region.
3. Cover’s counting
At zero margin the question can be answered exactly, with no thermodynamics at all, and the book does so before introducing any replicas.
A dichotomy is one of the assignments of signs to the patterns. Assume general position — every subset of at most pattern vectors is linearly independent, which independent Gaussian vectors satisfy with probability one. In weight space each equation is a hyperplane, and together the hyperplanes cut the sphere into regions within which all predicted signs are fixed. Their number is the number of realizable dichotomies.
Adding a new hyperplane splits exactly the regions it intersects, and those regions are counted by the same problem one dimension down. That gives the recursion , and with , for positive , and Pascal’s identity,
Since labels are equally likely, the probability that a random assignment is realizable is , which is the tail probability for . Compare the threshold with the mean: their difference is . At fixed it is positive and grows like for large , while the fluctuation grows only like . So the probability is driven to one below and to zero above it, and the crossover is resolved over a window of width of order .
The formula is small enough to check by hand in two dimensions, and the check is worth doing at the board. For , generic lines through the origin cut the circle into arcs, and agrees. At that is six realizable dichotomies out of eight, and at it is eight out of sixteen — the realizability probability falling through exactly at , which is the threshold in its finite- form. The general statement is binomial symmetry and holds at every , not only asymptotically.
Physical picture. This is a threshold with every ingredient a physicist would demand, and none of them imported: a sequence of systems indexed by , an intensive control parameter , an order parameter in the realizability probability, and a crossover width that was calculated rather than fitted. The limiting step function is a consequence of a finite- counting formula. Week 13 uses exactly this list as the standard against which a claimed transition in a trained model is read, and the reason the standard has teeth is that here it is met in full.
Checkpoints with answers
1. Why replace the hard sign when training by derivatives? Its derivative is zero away from the boundary and undefined on it. The smooth probabilistic loss supplies a derivative that measures the prediction error.
2. Can a hidden linear layer add expressive power to a linear output? No: is another affine function of . Nonlinearity is what prevents that collapse.
3. For three generic patterns in two dimensions, is every random labelling separable? No. Cover’s formula gives six of eight, hence probability . The threshold at concerns the large-system limit; it is not a promise for every finite dataset.
Subtleties and fine print
Feasibility is algorithm-independent; running time is not. The threshold says a separating weight vector exists below . It says nothing about whether a chosen procedure finds one, or how long it takes.
is a statement about a typical random labelling. It does not say every labelling at is realizable. The finite- formula is the exact statement; the threshold is its thermodynamic-limit consequence for independent random labels.
A vanishing volume is not infeasibility. The normalized volume can already be exponentially small below the threshold. That with does not by itself mean solutions have ceased to exist, and Week 4 depends on keeping the two apart.
General position is an assumption, satisfied here with probability one. For structured patterns — repeated vectors, collinear sets — the count changes, and the formula does not apply.
Zero margin is a boundary case handled by convention. Strict separation is taken when counting; for generic patterns the boundary faces carry zero spherical measure, so the convention does not affect the count.
Key claims and status
| Claim | Status |
|---|---|
| Two-layer gradients by the chain rule, route by route | [Exact.] |
| The normalization from | [Exact], for independent unit-variance inputs |
| [Exact] in general position | |
| [Exact] at finite | |
| [Exact], by binomial symmetry | |
| for independent random labels | [Thermodynamic limit], crossover width |
| The hard sign gives no ordinary gradient | [Exact]; its derivative is zero almost everywhere |
What the week establishes
- A neuron is a hyperplane with a squashing function, and its learning rule is the Week 1 gradient with the input as a multiplier.
- Fixing the weight norm is what makes a margin meaningful, and the in the normalized field follows from that constraint rather than being chosen.
- The number of realizable dichotomies is exactly , for any and in general position.
- The realizability probability tends to a step at , with a crossover window of width — every ingredient computed, none fitted.
What to carry forward. The change from Unit 0 is a change of question: from which distribution describes the data to how much of parameter space satisfies a constraint. That second question is the one statistical mechanics is built for, and Week 4 answers it again with a method whose limits are assumptions rather than theorems. Keep Cover’s answer in view while that happens — it is the independent check.
The practical session — guided calculation, part I
Varied: the number and direction of patterns, in two dimensions where the regions can be drawn. Held fixed: the spherical constraint and the zero-margin convention. Measured: the number of regions the hyperplanes cut the circle into, counted by hand, against .
Product: the drawn arcs for with the admissible region identified, the count checked against the formula, and the set-up of Gardner’s volume written out ready for Week 4.
Connections to other parts of the wiki
- Week 1 supplies the loss whose gradient drives the single update of §1.
- Week 4 asks the same feasibility question at nonzero margin, where no exact count is available and the replica method enters.
- Week 13 uses the four ingredients of §3 as its standard for reading a claimed transition in a trained model.
- nn-llm-unit-1 — the block skeleton this note implements.
Start here · All weeks · Book and experiments · Previous week · Next week