Preventing Deterioration of Classification Accuracy in Predictive Coding Networks

Paul F. Kinghorn, Beren Millidge, Christopher L. Buckley

TL;DR

Researchers have identified a strange "pathology" in Predictive Coding Networks (PCNs) where classification accuracy peaks and then plummets with continued training. This paper demonstrates that the decline isn't caused by overfitting, but by a mismatch in learning speeds between layers—a problem that can be fixed by simply balancing or capping the network's weights.

What Problem Does This Paper Address?

Predictive Coding (PC) is a brain-inspired framework where neural networks learn to minimize the "prediction error" between layers. Unlike standard deep learning, which uses global backpropagation, PCNs use local updates, making them highly attractive for both neuroscience and efficient hardware implementations.

However, researchers noticed a frustrating trend: as a PCN is trained on a task like image classification, its performance eventually starts to get worse. Crucially, this isn't standard overfitting—where the model memorizes the training data but fails on new data. In PCNs, accuracy drops on both training and test sets simultaneously. This paper sets out to diagnose why this happens and how to stop it.

Methods

The authors used a Generative Predictive Coding Network—a model that learns to generate images from labels. To classify an image, the network "inverts" itself, iteratively updating its internal state until it finds the label that best predicts the input image.

To solve the accuracy decay, they tested two primary interventions:

  1. Weight Regularization: They modified the weight update rule to ensure the mean size (L1 norm) of the weights in each layer remains constant throughout training.
  2. Weight Capping: A simpler, more biologically plausible approach where individual weights are prevented from exceeding a specific threshold (e.g., 0.1).

They compared these against a standard PCN and an unsupervised version where the top layer isn't "clamped" to specific labels during training.

Datasets

The study primarily uses the MNIST dataset, the "Hello World" of computer vision consisting of 70,000 handwritten digits.

  • Training: 60,000 images in batches of 640.
  • Testing: 10,000 images. While MNIST is a standard benchmark, it served as a clear environment to isolate and observe the specific mathematical pathology of the network.

Key Insights and Ideas

  • The Inference Speed Trap: The "accuracy drop" is actually a "speed drop." As training progresses, the network still could reach the correct answer, but it takes more and more iterations to get there. Because researchers typically stop inference after a fixed number of steps (e.g., 1,000), the network appears to be getting dumber when it's actually just getting slower.
  • The Supervised Mismatch: In supervised learning, we "clamp" the top layer to a specific label. This keeps the top-layer weights small. Meanwhile, the hidden layers are free to grow. This creates a massive imbalance in gradient magnitudes.
  • Energy-Based Equilibrium: PCNs are Energy-Based Models (EBMs). Inference is the process of the network "settling" into a low-energy state. The authors found that the top layer (the label layer) takes increasingly long to settle because its "influence" is dwarfed by the growing weights of the layers below it.
  • Hebbian vs. Anti-Hebbian: The PCN update rule naturally looks like Oja’s rule (a classic neuroscience model). It has a "growth" component and a "shrinkage" component. When a layer is clamped (supervised), the shrinkage dominates; when it's unclamped, the growth dominates.

Key Results

  • Stability Achieved: By applying weight regularization or capping, the authors successfully prevented the accuracy decay. In Figure 2 of the paper, the standard PCN accuracy dives after ~1,000 batches, while the regularized versions stay flat and high.
  • Quantitative Peak: Without intervention, accuracy on MNIST peaked and then fell toward 60%. With regularization, it maintained its peak performance (approx. 85-90% for this specific generative architecture) indefinitely.
  • Convergence Speed: In early training, the network reached equilibrium in ~100 steps. In late, unregulated training, it failed to reach equilibrium even after 1,000 steps. Regularization kept the convergence time stable.

Limitations and Future Work

  • The Role of Precisions: The authors used "identity matrices" for precisions (essentially assuming all errors are equally important). In more complex models, "precisions" act like an attention mechanism. The authors suggest that learning these precisions might naturally solve the imbalance, but they haven't tested this yet.
  • Hyperparameter Sensitivity: The "weight cap" method is sensitive to the specific cap chosen (0.1 in this study). Finding the "right" cap for different architectures remains an open question.
  • Scaling Up: While the math holds for MNIST, it remains to be seen how these dynamics play out in much deeper networks or more complex datasets like CIFAR-10 or ImageNet.

Summary updated

Abstract

Predictive Coding Networks (PCNs) aim to learn a generative model of the world. Given observations, this generative model can then be inverted to infer the causes of those observations. However, when training PCNs, a noticeable pathology is often observed where inference accuracy peaks and then declines with further training. This cannot be explained by overfitting since both training and test accuracy decrease simultaneously. Here we provide a thorough investigation of this phenomenon and show that it is caused by an imbalance between the speeds at which the various layers of the PCN converge. We demonstrate that this can be prevented by regularising the weight matrices at each layer: by restricting the relative size of matrix singular values, we allow the weight matrix to change but restrict the overall impact which a layer can have on its neighbours. We also demonstrate that a similar effect can be achieved through a more biologically plausible and simple scheme of just capping the weights.
BibTeX
@inproceedings{kinghorn2022preventing,
  author = {Paul F. Kinghorn and Beren Millidge and Christopher L. Buckley},
  title = {{Preventing Deterioration of Classification Accuracy in Predictive Coding Networks}},
  booktitle = {IWAI},
  year = {2022},
  doi = {10.1007/978-3-031-28719-0\_1},
}

Loading related content...

Figure