Geometrically Constrained Outlier Synthesis
Abstract
Deep neural networks for image classification often exhibit overconfidence on out-of-distribution (OOD) samples. To address this, we introduce Geometrically Constrained Outlier Synthesis (GCOS), a training-time regularization framework aimed at improving OOD robustness during inference. GCOS addresses a limitation of prior synthesis methods by generating virtual outliers in the hidden feature space that respect the learned manifold structure of in-distribution (ID) data. The synthesis proceeds in two stages: (i) a dominant-variance subspace extracted from the training features identifies geometrically informed, off-manifold directions; (ii) a conformally-inspired shell, defined by the empirical quantiles of a nonconformity score from a calibration set, adaptively controls the synthesis magnitude to produce boundary samples. The shell ensures that generated outliers are neither trivially detectable nor indistinguishable from in-distribution data, facilitating smoother learning of robust features. This is combined with a contrastive regularization objective that promotes separability of ID and OOD samples in a chosen score space, such as Mahalanobis or energy-based. Experiments demonstrate that GCOS outperforms state-of-the-art methods using standard energy-based inference on near-OOD benchmarks, defined as tasks where outliers share the same semantic domain as in-distribution data. As an exploratory extension, the framework naturally transitions to conformal OOD inference, which translates uncertainty scores into statistically valid p-values and enables thresholds with formal error guarantees, providing a pathway toward more predictable and reliable OOD detection.
Lay Summary
When a neural network trained to recognise familiar images is shown something it has never seen before, it usually produces a confident answer anyway rather than saying "I don't know." This is a serious problem in applications such as medical screening or industrial inspection, where it matters whether the system flags an unfamiliar case for human review or quietly mis-classifies it as something routine. A common way to teach a network to recognise unfamiliar inputs is to expose it to examples of unusual data during training. But real "unusual" data is hard to collect at scale, so researchers have tried to generate artificial examples. Existing methods either generate examples that are too easy -- the network learns to spot them but not the real unfamiliar inputs it would encounter in practice -- or rely on expensive image-generation models that slow training down considerably. We propose a method called GCOS. Instead of generating new images, GCOS produces artificial borderline examples inside the network's own internal representation of an image. A simple statistical procedure controls how far each artificial example sits from the known classes: far enough that the network treats it as unfamiliar, but not so far that the example becomes trivial to spot. The network sees these borderline cases throughout training and gradually learns to be appropriately uncertain about inputs that resemble them. We test GCOS on four problems ranging from coloured handwritten digits to retinal scans for eye disease. Across all of them, GCOS more reliably flags unfamiliar inputs than existing methods, while running much faster than image-generation alternatives. We also outline how the approach can be extended to deliver statistical confidence guarantees, moving the field a step closer to image-classification systems whose predictions come with calibrated reliability information.