Abstract
Few-shot classification requires models to generalize from minimal examples. Traditional Prototypical Networks (ProtoNet) represent classes as single points, which often fails to capture the underlying distribution's geometry. We present HyperProto, a method that models each class as a hypersphere with a learnable center and radius. This approach provides a more expressive yet computationally efficient representation, significantly improving performance across Natural Language Processing and Computer Vision benchmarks.
Introduction
Few-shot classification aims to teach machines to recognize new concepts from just a handful of examples. A dominant approach is metric-based meta-learning, where a model learns an embedding space where similar instances are clustered. The classic Prototypical Network (ProtoNet) represents each class as a single point—the mean of its few available support examples.
However, "points" are inherently limited. Real-world data for a specific class occupies a region with varying density and boundaries. While complex statistical modeling (e.g., covariance matrices) can capture this, such methods are often computationally expensive and numerically unstable. HyperProto addresses this gap by introducing a representation that is more expressive than a point but simpler and more robust than a full probability distribution.
Methodology
The core innovation of HyperProto is representing each class as a hypersphere $B(z, \epsilon)$, defined by two parameters: a Center ($z$) representing the class location and a Radius ($\epsilon$) representing its spatial extent or "reach."
Instead of calculating distance to a central point, the model calculates the distance from a query point to the surface of the hypersphere. Geometrically, if a point is inside the sphere, the distance is negative; if outside, it is the standard Euclidean distance minus the radius.
During a task, the center is initialized as the mean of support examples, and the radius is initialized based on their mean distance to that center. Unlike standard ProtoNet, where prototypes are fixed per episode, HyperProto treats these parameters as learnable components that can be optimized via gradient descent alongside the neural network encoder.
Experiments and Results
HyperProto was evaluated across diverse domains, including Natural Language Processing (FEW-NERD, FewRel) and Computer Vision (miniImageNet, CUB). The model consistently outperformed vanilla Prototypical Networks and competitive baselines:
- FEW-NERD: Achieved an absolute increase of 8.33% F1 on the INTRA split and 6.55% F1 on the INTER split compared to standard prototypes.
- miniImageNet: Reached 72.54% accuracy (5-way 5-shot) using a WideResNet backbone, surpassing several complex meta-learning algorithms.
Visualization via t-SNE plots confirms that HyperProto produces much tighter, more discriminative clusters than standard methods. The learnable radius acts as a proxy for class density; classes with diverse examples naturally evolve larger radii, while consistent classes develop smaller ones, allowing the model to adjust its "confidence zone" per class.
Conclusion
HyperProto demonstrates that simple geometric extensions to prototypical representations can yield significant gains in few-shot learning. By adding just one scalar parameter (the radius) per class, the model gains the ability to define areas of influence without the stability issues of higher-dimensional statistical modeling. While 1-shot settings remain challenging due to variance estimation bias, the hypersphere model offers a robust foundation for capturing concept boundaries in embedding spaces.
Summary updated