From Inverted Codes to Anisotropic Encoders: A Single Ratio Predicts Few-Shot Out-of-Distribution Accuracy
Abstract
Few-shot out-of-distribution (OOD) classification requires pre-trained encoders to generalize to unseen classes and novel corruptions. While performance variations across models are often attributed to scale or data, we demonstrate that this generalization is fundamentally a property of latent space geometry. We introduce the anisotropy ratio, a single metric quantifying how strongly an encoder contracts within-class (nuisance) variation relative to how strictly it preserves between-class (semantic) separation. Theoretically, we prove a margin law guaranteeing that one-shot nearest-centroid classification succeeds whenever the task margin adequately exceeds this ratio. Furthermore, we establish an isometry floor showing that invertible representations cannot improve this ratio beyond the raw input geometry, offering a geometric explanation for the performance gap between generative and contrastive models. Practically, we demonstrate that this ratio can be estimated from unlabeled, in-distribution data alone-requiring no gradients or access to the shifted test set. Extensive experiments across synthetic geometries and four image benchmarks, spanning seven encoder families and the CIFAR-10-C robustness suite, confirm that this label-free estimator strongly predicts actual OOD accuracy. Finally, all theoretical results are fully machine-checked in the Lean 4 proof assistant, ensuring mathematical rigor.
est. 32% chance this paper gets accepted at ICLR 2027.
What do you think this paper will get?
All positions stay anonymous.