An empirical study of Neural Collapse (Papyan et al, 2020) comparing SGD, Adam, AdamW, and SGDW on CIFAR-10 / ResNet-18.
Figure 1: PCA projections of penultimate-layer features at four training stages. SGD achieves near-perfect cluster separation by epoch 350 (within-class variance
Neural Collapse (NC) describes four geometric properties that emerge in the final-layer representations of deep classifiers when trained past zero training error: within-class features collapse to their class mean, the class means converge to a Simplex Equiangular Tight Frame, classifier weights align with the class means, and the network's predictions converge to a nearest-class-center rule. Papyan et al. (2020) established this phenomenon empirically using SGD. Recent theoretical work by Zhao et al. (ICLR 2026) proved that the choice of optimizer, specifically the coupling of weight decay, fundamentally determines whether NC emerges. This project provides a complementary geometric perspective: we reproduce the SGD baseline and extend the analysis to Adam, AdamW, and SGDW, using SVD spectrum analysis, norm tracking, and PCA projections to visualize how the representation geometry diverges across optimizers, and how much of that divergence traces back to decoupled weight decay versus adaptive gradients themselves.
-
SGD (Coupled) achieves near-complete Neural Collapse: within-class feature variance (NC1) drops to
$0.013$ , nearest-class-center agreement reaches$0.000$ , and test accuracy peaks at$\mathbf{95.39%}$ . -
Decoupled Weight Decay (SGDW & AdamW) degrades within-class collapse regardless of whether gradients are adaptive, and inflates classifier weight norms similarly (SGDW
$3.47$ , AdamW$4.26$ , vs SGD's$1.80$ ). Moving from SGD to SGDW causes a$\sim 10\times$ bump in within-class variance ($0.013 \to 0.128$ ), placing it right alongside AdamW ($0.133$ ). -
Adaptive Gradient Scaling (Adam & AdamW) drives ETF Symmetry (NC2) by equalizing learning across feature dimensions. AdamW achieves the best NC2 (
$0.351$ , vs SGD's$0.615$ , SGDW's$0.624$ ). -
Self-duality (NC3) shows a two-step degradation: decoupling alone takes NC3 from
$0.497$ (SGD) to$1.112$ (SGDW); adding adaptive gradient scaling on top pushes it further to$1.496$ (AdamW). Unlike NC1, where decoupling alone accounts for nearly the entire effect, NC3 damage comes from decoupling and adaptivity independently.
ResNet-18 adapted for CIFAR-10, following Papyan et al. (2020):
- First convolutional layer changed from
$7 \times 7$ to$3 \times 3$ (stride$1$ , padding$1$ ). - Max-pooling layer replaced with identity.
- Output:
$512$ -dimensional feature space that goes through linear head with$10$ classes.
All four optimizers are trained for
| Setting | SGD | Adam | AdamW | SGDW |
|---|---|---|---|---|
| Learning rate | ||||
| Weight decay | ||||
| Momentum | - | - | ||
| Betas | - | - |
The step-decay schedule is chosen deliberately: the discrete LR drops create sharp phase transitions that make the onset of Neural Collapse easier to isolate and study, compared to cosine annealing where the transition is gradual.
All metrics are computed on training-set features extracted from checkpoints saved every
-
NC1 (Within-Class Variability Collapse):
$\frac{1}{C} \text{tr}(\Sigma_W \Sigma_B^{\dagger})$ , where$\Sigma_W$ and$\Sigma_B$ are the within-class and between-class covariance matrices. Approaches$0$ as features collapse to their class means. -
NC2 (Simplex ETF Convergence):
$| \hat{M} \hat{M}^T - \frac{C}{C-1}(I_C - \frac{1}{C} \mathbf{1}\mathbf{1}^T) |_F$ , where$\hat{M}$ contains the$\ell_2$ -normalized centered class means. Approaches$0$ as the class means form a regular simplex. -
NC3 (Self-Duality):
$| \hat{W} - \hat{M} |_F$ , where$\hat{W}$ contains the$\ell_2$ -normalized centered classifier weight vectors. Approaches$0$ as the classifier mirrors the feature geometry. -
NC4 (NCC Agreement): The fraction of training samples where the model's argmax prediction disagrees with a nearest-class-center classifier. Approaches
$0$ as the two classifiers become equivalent.
Figure 2: Neural Collapse Metrics across 350 epochs. Vertical dashed lines mark LR drops at epochs 116 and 233. SGD converges to near-zero on all four metrics. AdamW achieves the best NC2 but diverges on NC3.
| Optimizer | Weight Decay | Train Acc | Test Acc | Train Loss | Test Loss |
|---|---|---|---|---|---|
| SGD | Coupled | ||||
| Adam | Coupled | ||||
| SGDW | Decoupled | ||||
| AdamW | Decoupled |
SGD generalizes best. Adam exhibits the largest generalization gap (
| Metric | SGD (Coupled) | Adam (Coupled) | SGDW (Decoupled) | AdamW (Decoupled) | Ideal |
|---|---|---|---|---|---|
| NC1 (Variability Collapse) | |||||
| NC2 (ETF Symmetry) | |||||
| NC3 (Self-Duality) | |||||
| NC4 (NCC Agreement) |
Figure 4: Cosine similarity
Figure 5: Normalized singular value spectrum (
A perfect
Figure 6: Average classifier weight norms
Self-duality (NC3) requires
- Papyan et al. showed NC metrics collapsing together under SGD. However, our results demonstrate that weight decoupling degrades NC1 almost entirely on its own (SGDW
$\approx$ AdamW, with or without adaptive gradients), whereas NC2's improvement is specifically attributable to adaptive gradient scaling, not decoupling. NC3 is the exception, where both mechanisms contribute independently rather than one dominating. -
Connecting to Zhao et al. (2026): Their SignGD-based NC0 diagnostic explains why decoupled decay blocks collapse, matching our finding that NC1 damage is decoupling-only. Our SGD-to-SGDW gap on NC1 (
$\sim 10\times$ ) is larger than the near-parity they report at the same nominal weight decay, plausibly due to our longer$350$ -epoch schedule. - Scope: These results are single-seed, single-architecture (ResNet-18), single-dataset (CIFAR-10) due to compute constraints. Extending to more architectures, datasets, and seeds would strengthen the conclusions.
# clone repo & install dependencies
git clone https://github.com/ahmadrazacdx/nc-optimizers.git
cd nc-optimizers
pip install -r requirements.txt
# prepare data (expects CIFAR-10 already downloaded to ./data; download=False by default)
python data.py
# run experiments (stored in `checkpoints/`)
python train.py --optimizer sgd
python train.py --optimizer adam
python train.py --optimizer adamw
python train.py --optimizer sgdw
# measure all nc metrics (stored in `artifacts/`)
python measure.py
# get all figures (stored in `figures/`)
python get_figures.pytrain.py trains ResNet-18 with the specified optimizer and saves checkpoints every 10 epochs. The flag config is:
| Flag | Requirement | Description | Default |
|---|---|---|---|
--optimizer |
required |
Optimizer to use. Choices: sgd, adam, adamw, sgdw. |
sgd |
--epochs |
optional |
Total training epochs. | 350 |
--batch_size |
optional |
Batch size. | 128 |
--lr |
optional |
Learning rate (used default otherwise). | - |
--weight_decay |
optional |
Weight decay (auto-set otherwise). | - |
- Papyan, V., Han, X., & Donoho, D. L. (2020). Prevalence of Neural Collapse during the terminal phase of deep learning training. Proceedings of the National Academy of Sciences, 117(40), 24652–24663. PNAS
- Zhao, J., Cheng, T. S., Masarczyk, W., & Lucchi, A. (2026). Optimizer choice matters for the emergence of Neural Collapse. ICLR 2026. arXiv:2602.16642
