Binary threshold unit Created 2026-10-14 Updated 2026-10-20
A binary threshold unit outputs one when its weighted input reaches its threshold and zero otherwise. Its hard threshold is not differentiable, so ordinary backpropagation cannot directly train the exact threshold model. Smooth activation functions can approximate its computation.
Four-input parity network Created 2026-10-14 Updated 2026-10-20
Let be the number of active inputs. Four hidden units , , detect successively larger counts. A binary threshold unit with weights on these features and threshold returns one precisely for . Each hidden input weight is one. This computes parity with a single hidden layer, but representability does not guarantee easy learning by backpropagation.
Let be the input to output weight for datum , including for the bias. With identity output activation, . The chain rule gives
The are held fixed when differentiating an output-layer weight; they may be hidden-layer activations rather than raw descriptors. Hidden-weight derivatives require backpropagation through the preceding layers.
Apply the chain rule to the squared loss, using the same pre-update weights throughout a forward and backward pass. At the output, and . Therefore
For a gradient descent step of size , define . This gives .
A hidden activation affects all output units to which it connects. Thus
and
The learning rate is already contained in and hence in ; do not multiply by it a second time. For a sigmoid function, . Thresholds can be treated as negative biases with an extra constant input and updated by the same derivative rule.
This is squared-error backpropagation. The forward pass computes activations, while the backward pass transports output-loss derivatives through the outgoing weights and the derivatives of the activation functions, yielding an error signal for every hidden unit. That reverse flow of derivatives explains the name backpropagation.
Two arguments favour backpropagation as a modelling tool. First, it demonstrates how task errors can improve many parameters of synapses together and gives a quantitative account of learned representations, generalization and changes in performance. Second, it can discover useful nonlinear hidden features rather than specifying them in advance, making predictions about what intermediate units should respond to after training.
Two arguments oppose interpreting standard backpropagation literally as nervous-system learning. First, the hidden error requires an accurately weighted reverse signal, including the same effective forward weights; this weight-transport requirement is not supplied by the ordinary local Hebbian learning rule. Second, a supplied output target and differentiable layer-by-layer credit assignment idealize the feedback and temporal information available to biological neurons, which use spike trains, delays and local synaptic plasticity. Success at learning a task establishes computational usefulness, not that the nervous system implements the identical algorithm.
Use the four-input parity network. Let . Four hidden units each receive all inputs with weight one and have thresholds . Thus
where for and zero otherwise. The output receives weights and has threshold :
The computation depends only on input count, so the following table checks all sixteen patterns at once:
The output is one exactly for an odd input count. The hidden features detect nested count thresholds, whose alternating sum extracts odd parity.
This representation does not make learning automatically easy. Hard binary threshold units have no usable ordinary derivative; backpropagation normally uses smooth approximations. With uniformly sampled parity patterns, each individual input has zero correlation with the target, so simple first-order features provide no direct cue to the required interaction. The desired output also flips between neighboring count classes. A smooth network has sufficient capacity, but its training can be sensitive to initialization, saturation and local optimization; representability and trainability are different issues.
For one observation, let and define . Differentiating the softmax function and its log-likelihood gives . The sigmoid-softmax network gradients are
These equations are backpropagation: use the chain rule through the output affine map, then through the hidden units, then the input affine map.
For a learning rate , select one observation and update every parameter by , computing all entries of the gradient from the old parameters before applying the update. A uniformly selected observation gives an unbiased gradient of the average log-likelihood; multiplying by 3000 would instead estimate the gradient of the sum. Equivalently perform stochastic gradient descent on the negative log-likelihood. Batch size one makes one update per observation, and five epochs make five passes through the data, typically with a fresh random ordering on each pass.
For one-hot labels and predicted probabilities , the categorical cross-entropy loss is
Stochastic gradient descent initializes , randomly orders the observations in each of five epochs, and for each single-observation batch computes a forward pass, the sample loss, and its gradient, then updates
Backpropagation is used after the forward loss evaluation to compute this gradient from the output layer back through the hidden layers.