Hyperspherical Forward-Forward with Prototypical Representations

Shalini Sarode, Brian Moser, Joachim Folz, Federico Raue, Tobias Nauen, Stanislav Frolov, Andreas DengelarXiv 2026

TL;DR

The Forward-Forward (FF) algorithm is a promising, biologically plausible alternative to backpropagation, but it suffers from an incredibly slow inference process that requires a separate forward pass for every single class. Hyperspherical Forward-Forward (HFF) solves this bottleneck by reframing the local learning objective into a direct multi-class classification problem within a hyperspherical feature space. By learning class-specific prototypes as geometric anchors, HFF enables single-pass inference—speeding up the process by over 40x—while significantly closing the accuracy gap with backpropagation on complex datasets like ImageNet.

What Problem Does This Paper Address?

Deep learning relies almost entirely on backpropagation. However, backpropagation is notoriously biologically implausible: it requires a perfect mathematical mirror of the network to pass gradients backward, forces sequential forward-backward execution, and demands high memory to store activations.

To address this, Geoffrey Hinton recently proposed the Forward-Forward (FF) algorithm, which replaces the backward pass with a second forward pass containing "negative" (incorrectly labeled) data. Each layer learns greedily using a local "goodness" metric.

Unfortunately, standard FF has a fatal flaw: inference scale. To classify an image at test time, the network must run a separate forward pass for every possible class to see which one yields the highest goodness score. For a dataset like ImageNet-1K, this means 1,000 forward passes per image, making it computationally impractical. Standard FF also requires complex, ad-hoc generation of negative data and struggles to scale to standard Convolutional Neural Networks (CNNs).

Methods

HFF redesigns the local layer objective from a binary classification task (positive vs. negative data) to a direct multi-class classification task.

Visualization of the HFF framework showing hyperspherical projection and prototypical learning.

Here is how a single HFF layer operates:

  1. Hyperspherical Projection: The layer takes the input, performs a standard linear or convolutional transformation, applies a non-linear activation (like ReLU), and then normalizes the output vector to have a Euclidean norm of 1. This projects the features onto a unit hypersphere.
  2. Class-Specific Prototypical Learning: Instead of calculating a single goodness scalar, each layer maintains a set of learnable, unit-norm prototypes (geometric anchors) for each class.
  3. LogSumExp Similarity: The network computes the similarity between the normalized feature vector and the class prototypes using a LogSumExp (LSE) function to produce a vector of logits (class scores) in a single pass.
  4. Contrastive Smooth-Margin Loss: The layer updates its weights using a local loss that pulls the feature vector closer to its true-class prototype while pushing it away from all negative class anchors.

Crucially, during training, the activations are detached from the computational graph before being passed to the next layer, ensuring that optimization remains strictly local and free of end-to-end backpropagation. For CNNs, HFF applies global average pooling and auxiliary $1\times1$ convolutions to decouple feature extraction from the local loss, allowing it to scale naturally to standard architectures.

Datasets

The authors evaluated HFF across five standard image classification benchmarks:

  • MNIST: 70,000 grayscale handwritten digits.
  • Fashion-MNIST (fMNIST): 70,000 grayscale clothing items.
  • CIFAR-10 (C10): 60,000 low-resolution natural images across 10 classes.
  • CIFAR-100 (C100): 60,000 low-resolution natural images across 100 fine-grained classes.
  • ImageNet-1K (IN1k): 1.28 million high-resolution training images across 1,000 diverse object categories.

Key Insights and Ideas

  • Direction Over Magnitude: Standard FF updates weights to make positive vectors longer and negative vectors shorter. HFF's gradient updates are mathematically orthogonal to the feature vector, meaning they change the direction of the vector on the hypersphere rather than its magnitude. This directly optimizes for angular separability.
  • Inherent Mathematical Stability: The authors prove that each HFF layer operation is Lipschitz continuous. This mathematical property guarantees that bounded changes in the input lead to bounded changes in the output, preventing exploding gradients without needing explicit regularization techniques.
  • Decoupling Labels from Inputs: Traditional FF requires embedding labels directly into the input pixels (e.g., via spatial masks), which disrupts convolutional operations. HFF completely decouples the local objective from feature extraction, enabling seamless integration with standard CNN backbones like AlexNet and VGG.

Key Results

1. Massive Inference Speedups

Because HFF computes all class scores simultaneously, its inference cost is $O(1)$ relative to the number of classes, whereas standard FF is $O(C)$. In wall-clock benchmarks on CIFAR-100, HFF achieved a >40x speedup over baseline FF, performing nearly identically to backpropagation. HFF also converged much faster during training, requiring only 4 epochs on MNIST compared to FF's 26.67 epochs.

Table 3: 1. Wall-clock inference time on C100 (val set) with batch size 1 on an NVIDIA RTX 3090 and 1 dataloader worker. 2. MNIST train time-to-convergence (Time to reach target validation accuracy ≥95%, for at least patience=3-epochs). All results are averaged over 3 trials.

2. State-of-the-Art Local Learning Accuracy

HFF consistently outperformed other backpropagation-free methods, particularly as dataset complexity scaled:

  • CIFAR-10: HFF-CNN achieved 83.08% accuracy, outperforming standard CNN FF by nearly 15 percentage points.
  • ImageNet-1K: HFF is among the first greedy local-learning methods to successfully scale to full ImageNet, achieving 25.70% from scratch.
  • Transfer Learning: When initialized with backprop-pretrained weights and fine-tuned using only local HFF losses, HFF-VGG16 achieved 65.96% accuracy on ImageNet, actually surpassing the standard backpropagation baseline (65.80%).
Table 1: Accuracy (%) of HFF-MLP compared to state-of-the-art local learning methods. Bold marks the best, underlined the second-best among local-loss methods, and blue the overall best (except backpropagation). ✓methods rely on explicit negatives, which are ad hoc and require multiple passes for inference, while methods with a ✗have implicit negatives and single-pass inference.

Limitations and Future Work

Despite its breakthroughs, the authors note several limitations:

  • Prototype Hyperparameters: The model relies on a fixed number of prototypes ($P$) per class. While $P=1$ worked best for their benchmarks, highly complex or multi-modal class distributions might require manual tuning or dynamic assignment strategies.
  • Memory Overhead: Storing local prototypes introduces an additional $D \times P \times C$ parameters per layer, increasing the model's memory footprint.
  • Information Bottleneck: The convolutional extension relies on global average pooling, which might discard valuable spatial information in early layers. Exploring alternative pooling strategies remains an open area for future research.

Summary updated

BibTeX
@misc{sarode2026hyperspherical,
  author = {Shalini Sarode and Brian Moser and Joachim Folz and Federico Raue and Tobias Nauen and Stanislav Frolov and Andreas Dengel},
  title = {{Hyperspherical Forward-Forward with Prototypical Representations}},
  year = {2026},
  eprint = {2605.00082},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.00082},
}
Figure