When Does Margin Clamping Affect Training Variance? Dataset-Dependent Effects in Contrastive Forward-Forward Learning
Not on the map. Why?
Abstract (arXiv)
Contrastive Forward-Forward (CFF) learning trains Vision Transformers layer by layer against supervised contrastive objectives. CFF training can be sensitive to random seed, but the sources of this instability are poorly understood. We focus on one implementation detail: the positive-pair margin in the contrastive loss is applied through saturating similarity clamping, min(s + m,, 1). We prove that an alternative formulation, subtracting the margin after the log-probability, is gradient-neutral under the mean-over-positives reduction. On CIFAR-10 (2 × 2 factorial, n=7 seeds per cell), clamping produces 5.90× higher pooled test-accuracy variance (p=0.003) with no difference in mean accuracy. Analyses of clamp activation rates, layerwise gradient norms, and a reduced-margin probe point to saturation-driven gradient truncation at early layers. The effect does not transfer cleanly to other datasets: on CIFAR-100, SVHN, and Fashion-MNIST, clamping produces equal or lower variance. Two factors account for the discrepancy. First, positive-pair density per batch controls how often saturation occurs. Second, task difficulty compresses seed-to-seed spread when accuracy is high. An SVHN difficulty sweep confirms the interaction on a single dataset, with the variance ratio moving from 0.25× at high accuracy to 16.73× under aggressive augmentation. In moderate-accuracy regimes with many same-class pairs per batch, switching to the gradient-neutral subtraction reference removes this variance inflation at no cost to mean accuracy. Measuring the layer-0 clamp activation rate serves as a simple check for whether the problem applies.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 16 of its 19 references that are in the map. First posted on arXiv 1 Mar 2026.
Builds on
16 of 19 references.
References · 16
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
- 2018Representation Learning with Contrastive Predictive Codingcited by 7,662
- 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,482
- 2020Supervised Contrastive Learningcited by 2,803
- 2018CosFace: Large Margin Cosine Loss for Deep Face Recognitioncited by 968
- 2017SphereFace: Deep Hypersphere Embedding for Face Recognitioncited by 733
- 2020Underspecification Presents Challenges for Credibility in Modern Machine Learningcited by 488
- 2020Fine-Tuning Pretrained Language Models: Weight Initializations, Data Orders, and Early Stoppingcited by 377
- 2021Understanding Robustness of Transformers for Image Classificationcited by 250
- 2019Training Neural Networks with Local Error Signalscited by 135
- 2018Greedy Layerwise Learning Can Scale to ImageNetcited by 113
4 more
- 2019Putting An End to End-to-End: Gradient-Isolated Learning of Representationscited by 85
- 2021Dissecting Supervised Contrastive Learningcited by 64
- 2024Self-Contrastive Forward-Forward Algorithmcited by 15
- 2025Contrastive Forward-Forward: A Training Algorithm of Vision Transformercited by 5
Built on by
Not cited yet.