Early Detection of Backbone Divergence via Neighborhood Structure in Learned Embeddings

Yiming Zhang, Reza Hassanpour, Georgi GaydadjievNeurIPS 2026

TL;DR

When we train neural networks, we usually watch loss and accuracy curves—metrics that sit at the very end of the pipeline and hide what is actually happening inside the representation space. This paper introduces the Volume Ratio Test (VRT), a parameter-free statistical microscope that looks directly at the geometry of a model's backbone embeddings to catch the exact moment it starts treating training data differently from unseen test data. Across 24 models, VRT spots this structural divergence dozens of epochs earlier than standard statistical tests, without needing tuned kernels or auxiliary classifiers.

What Problem Does This Paper Address?

Imagine watching a student take practice exams. Their final scores might plateau, or a gap might open up between their practice scores and real exam scores (the classic generalization gap). Still, those final grades don't tell you how they are thinking—are they genuinely learning concepts, or quietly memorizing the quirks of the practice questions deep in their mental map?

In deep learning, output-level metrics like negative log-likelihood (NLL) loss and validation accuracy leave us similarly blind to the backbone (the core feature-extractor layers before the final classification head). Even after downstream accuracy plateaus, a backbone can continue memorizing training samples, subtly warping how seen vs. unseen data are arranged in embedding space.

While statistical two-sample tests—like Maximum Mean Discrepancy (MMD), Energy Distance, or Classifier Two-Sample Tests (C2ST)—seem like natural tools to compare train and test embeddings, they struggle in practice. They treat embeddings as generic point clouds in Euclidean space, require tricky hyperparameter tuning (like kernel bandwidths), and turn out to be surprisingly brittle depending on how BatchNorm is configured during feature extraction.

Methods

Modern representation learning loves the unit hypersphere: $\ell_2$-normalizing embeddings strips away vector length and makes angles the currency of similarity. Rather than measuring global distances across the whole space, VRT asks a local, geometric question: Do training and test points sit in similarly dense neighborhoods on the hypersphere?

Overview of the three-stage Volume Ratio Test pipeline

Here is how VRT works in three lightweight steps:

  1. Data Preparation: Extract backbone embeddings for training and test sets and $\ell_2$-normalize them onto the unit hypersphere. Split the training embeddings into a fixed reference set ($R$, e.g., 2,000 points) and a training query set ($Q_{\text{tr}}$), while keeping the test embeddings as the test query set ($Q_{\text{te}}$).
  2. Geometric Scoring: For every query point, find its $k$ nearest neighbors (default $k=60$) in the reference set $R$ using cosine similarity. Convert those neighbor angles into hyper-spherical cap log-volumes. Here comes the mathematical elegance: by Rényi’s spacing theorem (1953), if points were uniformly distributed on the sphere, the rescaled spacings between consecutive log-volumes would behave like independent $\text{Exp}(1)$ random variables. Averaging these spacings gives each query point a clean, closed-form scalar score ($\hat{c}$) measuring its local neighborhood density relative to $R$.
  3. Statistical Testing: Compute the difference between the median score of test queries and the median score of training queries. Because all scalar scores are precomputed, VRT runs a fast 2,000-step label permutation test to get an exact $p$-value—adding negligible overhead to routine checkpointing and requiring zero learned parameters.

Datasets

Rather than introducing a new dataset, the authors evaluate VRT across 24 models in 16 configurations (spanning dimensions $D=32$ to $D=2,048$) trained on three standard vision benchmarks:

  • CIFAR-10 & CIFAR-100: Used for supervised CNNs/ResNets, pre-trained model zoos (including the Phase Transition Zoo), self-supervised SimCLR encoders, and controlled regularization experiments.
  • ImageNet-1K: Used to evaluate two DeepResNet-50 checkpoints (with simple and advanced augmentations) as negative/reference-protocol controls.
  • Synthetic von Mises–Fisher (vMF) Mixtures: Spherical cluster distributions constructed to probe what geometric shifts VRT vs. MMD actually detect.

Key Insights and Ideas

  • Global distances cancel out; local neighborhoods don't. On ResNet-50 at epoch 100, individual classes drift apart by an average of $6.1^\circ$ between train and test, and training points cluster more tightly within each class. Yet if you pool all classes together, the global centroid shift cancels out to just $0.68^\circ$! Global tests miss this cancellation; VRT catches it by summarizing local $k$-NN neighborhoods into scalar scores before comparing distributions.
  • Loss gaps $\neq$ backbone divergence. A widening train–test NLL gap does not guarantee the backbone geometry has diverged—overfitting can happen purely in the final classifier head (as seen in their 5-layer CNN control, where NLL diverges while the backbone remains stable). Conversely, sustained VRT rejection reliably signals that train–test separation has penetrated the representation space itself.
  • BatchNorm mode plays tricks on standard tests. Switching BatchNorm from eval mode (running stats) to train mode (current batch stats) during feature extraction leaves model weights untouched, yet delays or wipes out detections for MMD and Energy Distance. VRT remains remarkably consistent across both modes.
  • Weight decay tames backbone divergence better than augmentation. In a controlled $2\times2$ ResNet-18 experiment, strong data augmentation (AutoAugment + RandomErasing) barely delayed backbone divergence by 2 epochs, whereas $10\times$ stronger weight decay suppressed detectable divergence entirely.
Figure 2: VRT p-value trajectories under four regularization interventions on ResNet-18, CIFAR-10 (D = 512), with eval-mode BatchNorm extraction. Configuration A (baseline) reaches sustained rejection at epoch 33 and configuration C (strong augmentation) at epoch 35 (vertical dashed lines). Configurations B (10× weight decay) and D (weight decay + augmentation) remain below the detection threshold throughout training. Under the criteria in Table 1, MMD and C2ST do not detect divergence on any of the four configurations; ED and MMDAgg reject only on A, with ED starting at epoch 44 and MMDAgg at epoch 42. Median p-values over 50 seeds, plotted as −log10(p).

Key Results

  • Earliest Sustained Detection: Across all positive-control settings on normalized embeddings, VRT matches or beats MMD, MMDAgg, Energy Distance, and C2ST. When onset epochs differ, VRT detects divergence 9 to 54 epochs earlier in eval-mode BatchNorm, and 12 to 171 epochs earlier in train-mode.
  • Catching What Others Miss: On ResNet20-FRN (no BatchNorm, CIFAR-10) and strongly augmented ResNet-18, VRT detects sustained divergence at epochs 38 and 35 respectively, while all four main baselines fail to detect sustained divergence at all.
  • ResNet-50 & Self-Supervised Gains: On ResNet-50 (CIFAR-100), VRT triggers at epoch 61 regardless of BatchNorm mode, whereas MMD and Energy Distance trigger at epoch 73 (eval) or 121 (train), MMDAgg at 80, and C2ST at 121. On SimCLR (CIFAR-10), VRT leads the runner-up baseline by 55 epochs (epoch 229 vs. 283).
Figure 3: (a) Rejection rates on class-cluster and single-cluster alternatives (D=500, 5,000 points per sample, 2,000 permutations, 200 repetitions). Both tests use the same samples and ℓ2-normalized inputs. Constructions and additional conditions are given in Appendix D. (b) Sustained detection onset on ResNet-50 (CIFAR-100) under eval-mode and train-mode BatchNorm extraction, for MMD and ED on unnormalized and ℓ2-normalized features and for VRT. All tests use 10,000 training and 10,000 test samples with 50 seeds. Train-mode extraction moves the MMD and ED onsets to epoch 121; the VRT onset is epoch 61 in both modes.
  • Complementary Synthetic Power: When within-class concentration increases by just 5% across 10 spherical clusters, VRT rejects 91.5% of the time compared to 6% for MMD. Conversely, for a single global cluster rotated by $2^\circ$, MMD rejects 100% of the time vs. 4% for VRT.

Limitations and Future Work

The authors are admirably clear about what VRT does not measure:

  • Blind to vector norms: Because VRT $\ell_2$-normalizes embeddings onto the unit hypersphere, any train–test divergence encoded strictly in feature magnitudes (radial length) is invisible to it.
  • Blind to the classification head: VRT inspects backbone embeddings only; if a network overfits solely in its final linear layer, VRT will not flag it.
  • Reference-set asymmetry: Using training vs. test embeddings as the reference set $R$ asks slightly different geometric questions; on ImageNet-1K, VRT remains null with a training reference set but rejects when using test embeddings as the reference.
  • Diagnostic, not prescriptive (yet): VRT flags that local train–test geometry has diverged, though it does not directly quantify how much that shift hurts downstream tasks. Future work is primed to explore using VRT signals to actively guide regularization during training—though explicit future roadmaps are otherwise not discussed in the paper.

Summary updated

Abstract

Neural network training is typically monitored through loss and accuracy curves, but these quantities do not directly reveal when the backbone begins to encode training and test data differently. A train–test negative log-likelihood (NLL) gap shows probabilistic separation between training and test examples, but it does not reveal whether this separation is present in the backbone geometry. We introduce the Volume Ratio Test (VRT), a permutation-based two-sample test for $\ell_2$-normalized backbone embeddings that compares local angular neighborhood structure on the unit hypersphere. VRT converts $k$-nearest-neighbor angles into spherical-cap log-volume spacings and requires no kernel bandwidth selection or learned discriminator. Across 24 models in 16 configurations spanning embedding dimensions $D=32$ to $D=2{,}048$, VRT achieves the earliest sustained detection among the main baselines on normalized embeddings in all positive-control settings. Where VRT and the earliest detecting baseline have different onsets, VRT leads by 9 to 54 epochs under evaluation-mode BatchNorm extraction and by 12 to 171 epochs under training-mode BatchNorm extraction. On ResNet20-FRN without BatchNorm and the strongly augmented ResNet-18, VRT detects sustained divergence while MMD, MMDAgg, Energy Distance, and C2ST do not. On ResNet-50/CIFAR-100, VRT first rejects at epoch 61, compared with epoch 73 for MMD and Energy Distance, 80 for MMDAgg, and 121 for C2ST. The train–test NLL gap is $0.491$ at VRT onset and remains at least this large at subsequent checkpoints. More generally, sustained VRT rejection is typically accompanied by a persistent train–test loss gap, but large NLL gaps can occur without VRT rejection. VRT therefore distinguishes train–test separation in NLL from backbone-geometric divergence.
BibTeX
@inproceedings{zhang2026early,
  author = {Yiming Zhang and Reza Hassanpour and Georgi Gaydadjiev},
  title = {{Early Detection of Backbone Divergence via Neighborhood Structure in Learned Embeddings}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=2T2Cs2OHk1},
}
Figure