G ENERALIZING AND D ECOUPLING N EURAL C OLLAPSE VIA H YPERSPHERICAL U NIFORMITY G AP
A BSTRACT
The neural collapse (NC) phenomenon describes an underlying geometric symmetry for deep neural networks, where both deeply learned features and classifiers converge to a simplex equiangular tight frame.
It has been shown that both crossentropy loss and mean square error can provably lead to NC.
We remove NC’s key assumption on the feature dimension and the number of classes, and then present a generalized neural collapse (GNC) hypothesis that effectively subsumes the original NC.
Inspired by how NC characterizes the training target of neural networks, we decouple GNC into two objectives: minimal intra-class variability and maximal inter-class separability.
We then use hyperspherical uniformity (which characterizes the degree of uniformity on the unit hypersphere) as a unified framework to quantify these two objectives.
Finally, we propose a general objective – hyperspherical uniformity gap (HUG), which is defined by the difference between inter-class and intra-class hyperspherical uniformity.
HUG not only provably converges to
GNC, but also decouples GNC into two separate objectives.
Unlike cross-entropy loss that couples intra-class compactness and inter-class separability, HUG enjoys more flexibility and serves as a good alternative loss function.
Empirical results show that HUG works well in terms of generalization and robustness.
I NTRODUCTION
Recent years have witnessed the great success of deep representation learning in a variety of applications ranging from computer vision [37], natural language processing [16] to game playing [55, 64].
Despite such a success, how deep representations can generalize to unseen scenarios and when they might fail remain a black box.
Deep representations are typically learned by a multi-layer network with cross-entropy (CE) loss optimized by stochastic gradient descent.
In this simple setup, [86] has shown that zero loss can be achieved even with arbitrary label assignment.
After continuing to train the neural network past zero loss with CE, [60] discovers an intriguing phenomenon called neural collapse (NC).
NC can be summarized as the following characteristics:
• Intra-class variability collapse : Intra-class variability of last-layer features collapses to zero, indicating that all the features of the same class concentrate to their intra-class feature mean.
• Convergence to simplex ETF : After being centered at their global mean, the class-means are both linearly separable and maximally distant on a hypersphere.
Formally, the class-means form a simplex equiangular tight frame (ETF) which is a symmetric structure defined by a set of maximally distant and pair-wise equiangular points on a hypersphere.
• Convergence to self-duality : The linear classifiers, which live in the dual vector space to that of the class-means, converge to their corresponding class-mean and also form a simplex ETF.
• Nearest decision rule :
The linear classifiers behave like nearest class-mean classifiers.
The NC phenomenon suggests two general principles for deeply learned features and classifiers: minimal intra-class compactness of features ( i.e. , features of the same class collapse to a single point), and maximal inter-class separability of classifiers / feature mean ( i.e. , classifiers of different classes have maximal angular margins).
While these two principles are largely independent, popular loss functions such as CE and square error (MSE) completely couple these two principles together.
Since there is no trivial way for CE and MSE to decouple these two principles, we identify a novel quantity – hyperspherical uniformity gap (HUG), which not only characterizes intra-class feature compactness and inter-class classifier separability as a whole, but also fully decouples these two principles.
The decoupling enables HUG to separately model intra-class compactness and inter-class separability, making it highly flexible.
More importantly, HUG can be directly optimized and used to train neural networks, serving as an alternative loss function in place of CE and MSE for classification.
HUG is formulated as the difference between inter-class and intra-class hyperspherical uniformity.
Hyperspherical uniformity [48] quantifies the uniformity of a set of vectors on a hypersphere and is used to capture how diverse these vectors are on a hypersphere.
Thanks to the flexibility of
HUG, we are able to use many different formulations to characterize hyperspherical uniformity, including (but not limited to) minimum hyperspherical energy (MHE) [45], maximum hyperspherical separation (MHS) [48] and maximum gram determinant (MGD) [48].
Different formulations yield different interpretation and optimization difficulty ( e.g. , HUG with MHE is easy to optimize, HUG with MGD has interesting connection to geometric volume), thus leading to different performance.
Similar to CE loss, HUG also provably leads to NC under the setting of unconstrained features [53].
Going beyond NC, we hypothesize a generalized NC (GNC) with hyperspherical uniformity, which extends the original NC to the scenario where there is no constraint for the number of classes and the feature dimension.
NC requires the feature dimension no smaller than the number of classes while
GNC no longer requires this.
We further prove that HUG also leads to GNC at its objective minimum.
Another motivation behind HUG comes from the classic Fisher discriminant analysis (FDA) [19] where the basic idea is to find a projection matrix T that maximizes between-class variance and minimizes within-class variance.
What if we directly optimize the input data (without any projection) rather than optimizing the linear projection in FDA?
We make a simple derivation below:
Projection FDA:
[Equation]
Data
[Equation] [Equation]
x 1 , ··· , x n ∈ S d − 1 tr ( S b ) − tr ( S w ) where the between-class scatter matrix is S w
= (cid:80) Ci =1 (cid:80)
j ∈
A c ( x j − µ i )( x j − µ i ) ⊤ , the within-class scatter matrix is S b =
(cid:80) Ci =1 n i ( µ i − ¯ µ )( µ i − ¯ µ ) ⊤ , n i is the number of samples in the i -th class, n is the total number of samples, µ i = n − 1 i (cid:80)
j ∈
A c x j is the i -th class-mean, and ¯ µ = n − 1 (cid:80) nj
=1 x j is the global mean.
By considering class-balanced data on the unit hypersphere, optimizing data
FDA is equivalent to simultaneously maximizing tr ( S b ) and minimizing tr ( S w ) .
Maximizing tr ( S b ) encourages inter-class separability and is a necessary condition for hyperspherical uniformity.
Minimizing tr ( S w ) encourages intra-class feature collapse, reducing intra-class variability.
Therefore,
HUG can be viewed a generalized FDA criterion for learning maximally discriminative features.
However, one may ask the following questions: Why is HUG useful if we already have the FDA criterion?
Could we simply optimize data FDA?
In fact, the FDA criterion has many degenerate solutions.
For example, we consider a scenario of 10-class balanced data where all features from the first 5 classes collapse to the north pole on the unit hypersphere and features from the rest 5 classes collapse to the south pole on the unit hypersphere.
In this case, tr ( S w ) is already minimized since it achieves the minimum zero.
tr ( S b ) also achieves its maximum n at the same time.
In contrast, HUG naturally generalizes FDA without having these degenerate solutions and serves as a more reliable criterion for training neural networks.
We summarize our contributions below:
• We decouple the NC phenomenon into two separate learning objectives: maximal inter-class separability ( i.e. , maximally distant class feature mean and classifiers on the hypersphere) and minimal intra-class variability ( i.e. , intra-class features collapse to a single point on the hypersphere).
• Based on the two principled objectives induced by NC, we hypothesize the generalized NC which generalizes NC by dropping the constraint on the feature dimension and the number of classes.
• We identify a general quantity called hyperspherical uniformity gap, which well characterizes both inter-class separability and intra-class variability.
Different from the widely used CE loss, HUG naturally decouples both principles and thus enjoys better modeling flexibility.
• Under the HUG framework, we consider three different choices for characterizing hyperspherical uniformity: minimum hyperspherical energy, maximum hyperspherical separation and maximum Gram determinant.
HUG provides a unified framework for using different characterizations of hyperspherical uniformity to design new loss functions.
O N G ENERALIZING AND D ECOUPLING N EURAL C OLLAPSE
NC describes an intriguing phenomenon for the distribution of last-layer features and classifiers in overly-trained neural networks, where both features and classifiers converge to ETF.
However, ETF can only exist when the feature dimension d and the number of classes C satisfy
d ≥ C − 1 .
This is not always true for deep neural networks.
For example, neural networks for face recognition are usually trained by classifying large number of classes ( e.g. , more than 85K classes in [23]), and the feature dimension ( e.g. , 512 in SphereFace [43]) is usually much smaller than the number of classes.
In general, when the number of classes is already large, it is prohibitive to use a larger feature dimension.
Thus a question arises: what will happen in this case if a neural network is fully trained?
[Figure] [Figure]
[Figure]
Motivated by this question, we conduct a simple experiment to simulate the case of d ≥ C − 1 and the case of d<C − 1 .
Specifically, we train a convolutional neural network (CNN) on MNIST with feature dimension 2.
For the case of d ≥ C − 1 , we use only 3 classes (digit 0,1,2) as the training set.
For the case of d<C − 1 , we use all 10 classes as the training set.
We visualize the learned features of both cases in Figure 1.
The results verify the case of d ≥ C − 1 indeed approaches to NC, and
ETF does not exist in the case of d<C − 1 .
Interestingly, one can observe that learned features in both cases approach to the configuration of equally spaced frames on the hypersphere.
To accommodate the case of d<C − 1 , we extend NC to the generalized NC by hypothesizing that last-layer inter-class features and classifiers converge to equally spaced points on the hypersphere, which can be characterized by hyperspherical uniformity.
Generalized Neural Collapse (GNC)
We define the feature global mean as µ G =
Ave i,c x i,c where x i,c ∈ R d is the last-layer feature of the i -th sample in the c -th class, the feature class-mean as µ c =
Ave i x i,c for different classes c ∈{ 1 , · · · , C } , the feature within-class covariance as Σ W =
Ave i,c ( x i,c − µ c )( x i,c − µ c ) ⊤ and the feature between-class covariance as Σ B = Ave c ( µ c − µ G )( µ c − µ G ) ⊤ .
GNC states that
• (1) Intra-class variability collapse : Intra-class variability of last-layer features collapse to zero, indicating that all the features of the same class converge to their intra-class feature mean.
Formally, GNC has that Σ † B Σ W → 0 where † denotes the Moore-Penrose pseudoinverse.
• (2) Convergence to hyperspherical uniformity : After being centered at their global mean, the class-means are both linearly separable and maximally distant on a hypersphere.
Formally, the class-means converge to equally spaced points on a hypersphere,
i
e. ,
(cid:88)
[Equation]
where ˆ µ i = ∥ µ i − µ G ∥ − 1 ( µ i − µ G ) and K ( · , · ) is a kernel function that models
pairwise interaction.
Typically, we consider Riesz s -kernel K s (ˆ µ c , ˆ µ c ′ )
=
sign ( s ) ·∥ ˆ µ c − ˆ µ c ′
∥
− s or logarithmic kernel K log (ˆ µ c , ˆ µ c ′ )
=log ∥
ˆ µ c − ˆ µ c ′ ∥ − 1 .
For example, the Riesz s -kernel with s = d −is a variational characterization of hyperspherical uniformity ( e.g. , hyperspherical energy [45]) using Newtonian potentials.
In the case of d =3 , s =1 , the Riesz kernel is called Coulomb potential and the problem of finding minimal coulomb energy is called Thomson problem [70].
• (3) Convergence to self-duality : The linear classifiers, which live in the dual vector space to that of the class-means, converge to their corresponding class-means, leading to hyperspherical uniformity.
Formally, GNC has that ∥ w c ∥ − 1 w c − ˆ µ c → 0 where w c ∈ R
d
is the c -th classifier.
• (4) Nearest decision rule : The learned linear classifiers behave like the nearest class-mean classifiers.
Formally, GNC has that arg max c ⟨ w c , x ⟩ + b c →
arg min c ∥ x − µ c ∥ .
In contrast to NC, GNC further considers the case of d<C − 1 and hypothesizes that both feature class-means and classifiers converge to hyperspherically uniform point configuration that minimizes some form of pairwise potentials.
Similar to how NC connects tight frame theory [74] to deep learning, our GNC hypothesis connects potential theory [3] to deep learning, which may shed new light on understanding it.
We show in Theorem 1 that GNC reduces to NC in the case of d ≥ C − 1 .
Theorem 1 (Regular Simplex Optimum for GNC) Let f : (0 , 4]
→ R be a convex and decreasing function defined at v =0 by lim v → 0 + f ( v ) .
If 2 ≤ C ≤ d +1 , then we have that the vertices of regular ( C − 1) -simplices inscribed in S d − 1 with centers at the origin (equivalent to simplex ETF) minimize the hyperspherical energy (cid:80) c
̸ = c ′ K (ˆ µ c , ˆ µ c ′ ) on the unit
hypersphere S
d − 1 ( d ≥ 3 ) with the kernel as K (ˆ µ c , ˆ µ c ′ )
=
f ( ∥ ˆ µ c − ˆ µ c ′ ∥ 2 ) .
If f is strictly convex and strictly decreasing, then these are the only energy minimizing C -point configurations.
Thus GNC reduces to NC when d ≥ C − 1 .
[Figure]
We note that Theorem 2 guarantees the simplex ETF as the minimizer of a general family of hyperspherical energies (as long as f is convex and decreasing).
This suggests that there are many possible kernel functions K ( · , · ) in GNC that can effectively generalize NC.
The case of d<C − 1 is where GNC really gets interesting but complicated.
Other than the regular simplex case, we also highlight a special uniformity case of 2 d = C .
In this case, we can prove in Theorem 2 that GNC(2) converges to the vertices of a cross-polytope as hyperspherical energy gets minimized.
As the number of classes gets infinitely large, we show in Theorem 3 that GNC(2) leads to a point configuration that is uniformly distributed on S d − 1 .
Additionally, we show a simple yet interesting result in Proposition 1 that the last-layer classifiers are already initialized to be uniformly distributed on the hypersphere in practice.
Theorem 2 (Cross-polytope Optimum for GNC)
If C =2 d , then the vertices of the cross-polytope are the minimizer of the hyperspherical energy in GNC(2).
The cross-polytope optimum for GNC(2) is in fact quite intuitive, because it corresponds to the
Cartesian coordinate system (up to a rotation).
For example, the vertices of the unit cross-polytope in R 3 are ( ± 1 , 0 , 0) , (0 , ± 1 , 0) , (0 , 0 , ± 1) .
These 6 vectors minimize the hyperspherical energy on S. We illustrate both the regular simplex and cross-polytope cases in Figure 2.
For the other cases of d<C − 1 , there exists generally no simple and universal point structure that minimizes the hyperspherical energy, as heavily studied in [12, 27, 38, 63].
For the point configurations that asymptotically minimize the hyperspherical energy as C grows larger, Theorem 3 can guarantee that these configurations asymptotically converge to a uniform distribution on the hypersphere.
Theorem 3 (Asymptotic Convergence to Hyperspherical Uniformity) Consider a sequence of point configurations { ˆ µ C 1 , · · · , ˆ µ CC } ∞ C =2 that asymptotically minimizes the hyperspherical energy on S d −as C → ∞ , then { ˆ µ C 1 , · · · , ˆ µ CC } ∞ C
=2 is uniformly distributed on the hypersphere S d − 1 .
Proposition 1 (Minimum Energy Initialization) With zero-mean Gaussian initialization (e.g., [22, 28]), the C last-layer classifiers of neural networks are initialized as a uniform distribution on the hypersphere.
The expected initial energy is C ( C − 1) (cid:82) S d − 1 (cid:82) S d − 1 ∥
ˆ µ c − ˆ µ c ′ ∥
− 2 dσ d − 1 (ˆ µ c )
dσ d − 1 (ˆ µ c ′ ) .
With Proposition 1, one can expect that the hyperspherical energy of the last-layer classifiers will first increase and then decrease to a lower value than the initial energy.
To validate the effectiveness of our GNC hypothesis, we conduct a few experiments to show how both class feature means and classifiers converge to hyperspherical uniformity ( i.e. , minimizing the hyperspherical energy), and how intra-class feature variability collapses to almost zero.
We start with an intuitive understanding about GNC from Figure 1.
The results are directly produced by the learned features without any visualization tool (such as t-SNE [73]), so the feature distribution can reflect the underlying one learned by neural networks.
We observe that GNC is attained in both d<C − 1 and d ≥ C − 1 , while
NC is violated in d<C − 1 since the learned feature class-means can no longer form a simplex ETF.
To see whether the same conclusion holds for higher feature dimensions, we also train two CNNs on
CIFAR-100 with feature dimension as 64 and 128, respectively.
The results are given in Figure 3.
Figure 3 shows that GNC captures well the underlying convergence of the neural network training.
Figure 3(a,c) shows that the hyperspherical energy of feature class-means and classifiers converge to a small value, verifying the correctness of GNC(2) and GNC(3) which indicate both feature class-means and classifiers converge to hyperspherical uniformity.
More interestingly, in the MNIST experiment, we can compute the exact minimal energy on S 1 : 2 in the case of d =2 , C =
( 1 / 3 for average energy) and ≈ 82 .
5 in the case of d =2 , C =10 ( ≈ 0 .
917 for average energy).
The final average energy in Figure 3(a) matches our theoretical minimum well.
From Figure 3(c), we observe that the classifier energy stays close to its minimum at the very beginning, which matches our Proposition
[Figure]
[Table]
that vectors initialized with zero-mean Gaussian are uniformly distributed over the hypersphere (this phenomenon becomes more obvious in higher dimensions).
To evaluate the intra-class feature variability, we consider a hyperspherical reverse-energy E r = (cid:80) i ̸
=
j ∈
A c ∥
ˆ x i − ˆ x j ∥ where ˆ x i
= x i ∥ x i ∥ and A c denotes the sample index set of the c -th class.
The smaller this reverse-energy gets, the less intra-class variability it implies.
Figure 3(b,d) shows that the intra-class feature variability approaches to zero, as GNC(1) suggests.
More empirical results on GNC ( e.g. , ImageNet) is in given Appendix A.
Now we discuss how to decouple the GNC hypothesis and how such a decoupling can enable us to design new objectives to train neural networks.
GNC(1) and GNC(2) suggest to minimize intra-class feature variability and maximize inter-class feature separability, respectively. GNC(3) and GNC(4) are natural consequences if GNC(1) and GNC(2) hold.
It has long been discovered in [42, 68, 82] that last-layer classifiers serve as proxies to represent the corresponding class of features, and they are also an approximation to the feature class-means. GNC(3)
indicates the classifiers converge to hyperspherical uniformity, which, together with GNC(1), implies GNC(4).
Until now, it has been clear that GNC really boils down to two decoupled objectives: maximize inter-class separability and minimize intra-class variability , which again echos the goal of FDA.
The problem reduces to how to effectively characterize these two objectives while being decoupled for flexibility (unlike CE or MSE).
In the next section, we propose to address this problem by characterizing both objectives with a unified quantity - hyperspherical uniformity.
H YPERSPHERICAL U NIFORMITY G AP 3. G ENERAL F RAMEWORK
As GNC(2) suggests, the inter-class separability is well captured by hyperspherical uniformity of feature class-means, so it is natural to directly use it as a learning target.
On the other hand,
GNC(1) does not suggest any easy-to-use quantity to characterize intra-class variability.
We note that minimizing intra-class variability is actully equivalent to encouraging features of the same class to concentrate on a single point, which is the opposite of hyperspherical uniformity.
Therefore, we can unify both intra-class variability and inter-class separability with a single characterization of hyperspherical uniformity.
We propose to maximize the hyperspherical uniformity gap:
[Equation]
where α, β are hyperparameters, ˆ µ c = µ c ∥ µ c ∥ is the feature class-mean projected on the unit hypersphere, µ c = (cid:80) c
∈
A c x c is the feature class-mean, x i is the last-layer feature of the i -th sample and
A c denotes the sample index set of the c -th class.
HU ( { v i } mi =1 ) denotes some measure of hyperspherical uniformity for vectors { v 1 , · · · , v m } .
Eq.
2 is the general objective for HUG.
Without loss of generality, we assume that the larger it gets, the stronger hyperspherical uniformity we have.
We mostly focus on supervised learning with parameteric class proxies 2 where the CE loss is widely used as a de facto choice, although HUG can be used in much broader settings as discussed later.
In the HUG framework, there is no longer a clear notion of classifiers (unlike the CE loss), but we still can utilize class proxies ( i.e. , a generalized concept of classifiers) to facilitate the optimization.
We observe that Eq.
2 directly optimizes the feature class-means for inter-class separability, but they are intractable to compute during training (we need to compute them in every iteration).
Therefore it is nontrivial to optimize the original HUG for training neural networks.
A naive solution is to approximate feature class-mean with a few mini-batches such that the gradients of T b can be still back-propagated to the last-layer features.
However, it may take many mini-batches in order to obtain a sufficiently accurate class-mean, and the approximation gets much more difficult with large number of classes.
To address this, we employ parametric class proxies to act as representatives of intra-class features and optimize them instead of feature class-means.
We thus modify the HUG objective as
[Equation]
[Table]
[Equation]
[Table]
[Equation]
where ˆ w c ∈ S
d − 1 is the parametric proxy for the c -th class.
The intra-class hyperspherical uniformity term connects the class proxies with features by minimizing their joint hyperspherical uniformity, guiding features to move towards their corresponding class proxy.
When training a neural network, the objective function in Eq.
3 will optimize network weights and proxies together.
There are alternative ways to design the HUG loss from Eq.
2 for different learning scenarios, as discussed in Appendix C.
Learnable proxies .
We can view the class proxy ˆ µ i as learnable parameters and update them with stochastic gradients, similarly to the parameters of neural networks.
In fact, learnable proxies play a role similar to the last-layer classifiers in the CE loss, improving the optimization by aggregating intra-class features.
The major difference between learnable proxies and moving-averaged proxies is the way we update them.
As GNC(3) implies, class proxies in HUG can also be used as classifiers.
Static proxies .
Eq.
3 is decoupled into maximal inter-class separability and minimal intra-class variability.
These two objects are independent and do not affect each other.
We can thus optimize them independently.
This suggests a even simpler way to assign class proxies – initializing class proxies with prespecified points that have attained hyperspherical uniformity, and fixing them in the training.
There are two simple ways to obtain these class proxies: (1) minimizing their hyperspherical energy beforehand; (2) using zero-mean Gaussian to initialize the class proxies (Proposition 1).
After initialization, class proxies will stay fixed and the features are optimized towards their class proxies.
Partially learnable proxies .
After the class proxies are initialized using the static way above, we can increase its flexibility by learning an orthogonal matrix for the class proxies to find a suitable orientation for them.
Specifically, we can learn this orthogonal matrix using methods in [47].
3. V ARIATIONAL C HARACTERIZATION OF H YPERSPHERICAL U NIFORMITY
While there exist many ways to measure hyperspherical uniformity, we seek variational characterization due to simplicity.
As examples, we consider minimum hyperspherical energy [45] that is inspired by Thomson problem [66, 70] and minimizes the potential energy, maximum hyperspherical separation [48] that is inspired by Tammes problem [69] and maximizes the smallest pairwise distance, and maximum gram determinant [48] that is defined by the volume of the formed parallelotope.
Minimum hyperspherical energy .
MHE seeks to find an equilibrium state with minimum potential energy that distributes n electrons on a unit hypersphere as evenly as possible.
Hyperspherical uniformity is characterized by minimizing the hyperspherical energy for n vectors V n = { v 1 , · · · , v n ∈ R d } :
[Equation]
where ˆ v i := v i ∥ v i ∥ is the i -th vector projected onto the unit hypersphere.
With HU ( ˆ V )=
− E s ( ˆ V ) , we apply MHE to HUG and formulate the new objective as follows ( s b =2 , s w = − 1 ):
[Equation]
which can already be used as to train neural networks.
The intra-class variability term in Eq.
5 can be relaxed to a upper bound such that we can instead minimize a simple upper bound of L MHE-HUG :
[Equation]
which is much more efficient to compute in practice and thus can serve as a relaxed HUG objective.
Moreover, L MHE-HUG and L
′ MHE-HUG share the same minimizer.
Detailed derivation is in Appendix H.
Maximum hyperspherical separation .
MHS uses a maximum geodesic separation principle by maximizing the separation distance ϑ ( ˆ V n ) ( i.e. , the smallest pairwise distance in V n = { v 1 , · · · , v n ∈
[Equation]
min i
[Equation]
= j ∥ ˆ v i − ˆ v j ∥} .
Because ϑ ( ˆ V n ) is another variational definition, we cannot naively set HU ( · ) = ϑ ( · ) .
We define ϑ − 1 ( ˆ V n ):=max i ̸
= j ∥ ˆ v i − ˆ v j ∥ and HUG becomes
[Equation]
which, by replacing intra-class variability with its surrogate, results in a more efficient form:
[Equation]
which is a max-min optimization with a simple nearest neighbor problem inside.
We note that
L MHS-HUG and L ′ MHS-HUG share the same maximizer.
Detailed derivation is given in Appendix H.
Maximum gram determinant .
MGD characterizes the uniformity by computing a proxy to the volume of the parallelotope spanned by the vectors.
MGD is defined with kernel gram determinant:
[Equation]
where we use a Gaussian kernel with parameter ϵ and G ( ˆ V n ) is the kernel gram matrix for ˆ V n = { ˆ v 1 , · · · , ˆ v n } .
With HU ( ˆ V n )=det G ( ˆ V n ) , minimizing intra-class uniformity cannot be achieved by minimizing det G ( ˆ V n ) , since det G ( ˆ V n )=0 only leads to linear dependence.
Then we have
[Equation]
where we directly use the surrogate loss from Eq.
6 as the intra-class variability term.
With MGD,
HUG has interesting geometric interpretation – it encourages the volume spanned by class proxies to be as large as possible and the volume spanned by intra-class features to be as small as possible.
3. T HEORETICAL I NSIGHTS AND D ISCUSSIONS
There are many interesting theoretical questions concerning HUG, and this framework is highly related to a few topics in mathematics, such as tight frame theory [74], potential theory [39], sphere packing and covering [3, 18, 25].
The depth and breath of these topics are beyond imagination.
In this section, we focus on discussing some highly related yet intuitive theoretical properties of HUG.
Theorem 4 (Order of Minimum Hyperspherical Energy)
If d − 1 >s> 0 or 0 >s> − 2 and d ∈
N , we have that lim n →∞ { n − 2 · min ˆ V n E s ( ˆ V n ) } =
c ( s, d ) where c ( s, d ) is a constant involving s, d .
The result above shows that the leading term of the minimum energy grows of order O ( n 2 ) as n →∞ .
Theorem 4 generally holds with a wide range of s for the Riesz kernel in hyperspherical energy.
Moreover, the following result shows that MHS is in fact a limiting case of MHE as s →∞ .
Proposition 2 (MHS is a Limiting Case of MHE) Let n ∈ N , n ≥ 2 be fixed and ( S d − 1 , L 2 ) be a compact metric space.
We have that lim s →∞ (min ˆ V
[Equation]
Proposition
The HUG objectives in both Eq.
5 and Eq.
6 converge to simplex ETF when 2 ≤ C ≤ d + 1 , converge to cross-polytope when C = 2 d and asymptotically converge to GNC as C → ∞ .
Proposition 3 shows that HUG not only decouples GNC but also provably converges to GNC.
Since
GNC indicates that the CE loss eventually approaches to the maximizer of HUG, we now look into how the CE loss implicitly maximizes the HUG objective in a coupled way.
Proposition 4 The CE loss is L CE =
(cid:80) ni
=1 log(1+ (cid:80) Cj ̸
= y i exp( ⟨ w j , x i ⟩−⟨ w y i , x i ⟩ )) where n is the number of samples, x i is the i -th sample with label
y i and w j is the last-layer linear classifier for the j -th class.
Bias is omitted for simplicity.
L CE is bounded by ( ρ = C − 1 ) n
[Equation]
) (cid:124)
[Equation]
[Table]
We show in Proposition 4 that CE inherently optimizes two independent criterion: intra-class variability (IV) and inter-class separability (IS).
With normalized classifiers and features, we can see that Q 1 and Q 3 have similar minimum where x i = w y i and w i , ∀
i attain hyperspherical uniformity.
We show that CE is lower bounded by the gap of inter-class and intra-class hyperspherical uniformity:
L CE ≥ n (cid:88) i = log
C (cid:88) c
= exp( ρn (cid:88)
j = l jc ⟨ x i , x j ⟩ ) − ρn (cid:88)
i =
(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) 1 n n (cid:88) i
=
l ic x i (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)
(cid:124) (cid:123)(cid:122) (cid:125)
Inter-classHypersphericalUniformity − ρn (cid:88) i = (cid:88) j ∈
A yi ⟨ x i , x j ⟩ (cid:124) (cid:123)(cid:122) (cid:125) Intra-classHypersphericalUniformity
(11) where ρ 1 , ρ 2 , ρ 3 are constants and l ic is the softmax confidence of x i for the c -th class (Appendix L).
This result [4] implies that minimizing CE effectively minimizes HUG.
[50] proves that the minimizer of the normalized CE loss converges to hyperspherical uniformity.
We rewrite their results below:
Theorem 5 (CE Asymptotically Converges to HUG’s Maximizer)
Considering unconstrained features of C classes (each class has the same number of samples), with features and classifiers normalized on some hypersphere, we have that, for the minimizer of the CE loss, classifiers converge weakly to the uniform measure on S d − 1 as C →∞ and features collapse to their corresponding classifiers.
The minimizer of CE also asymptotically converges to the maximizer of HUG.
Theorem 5 shows that the minimizer of the CE loss with unconstrained features [53] asymptotically converges to the maximizer of HUG ( i.e. , GNC).
Till now, we show that HUG shares the same optimum with CE (with hyperspherical normalization), while being more flexible for decoupling inter-class feature separability and intra-class feature variability.
Therefore, we argue that HUG can be an excellent alternative for the widely used CE loss in classification problems.
HUG maximizes mutual information .
We can view HUG as a way to maximize mutual information
I ( X ; Y )=
H ( X ) −H ( X | Y ) , where X denotes the feature space and Y is the label space.
Maximizing H ( X ) implies that the feature should be uniform over the space.
Minimizing H ( X | Y ) means that the feature from the same class should be concentrated.
This is nicely connected to HUG.
The role of feature and class proxy norm .
Both NC and GNC do not take the norm of feature and class proxy into consideration.
HUG also assume both feature and class proxy norm are projected onto some hypersphere.
Although dropping these norms usually improves generalizability [8, 9, 14, 43, 76], training neural networks with standard CE loss still yields different class proxy norms and feature norms.
We hypothesize that this is due to the underlying difference among training data distribution of different classes.
One empirical evidence to support this is that average feature norm of different classes is consistent across training under different random seeds ( e.g. , average feature norm for digit 1 on MNIST stays the smallest in different run).
[36, 46, 52] empirically show that feature norm corresponds to the quality of the sample, which can also viewed as a proxy to sample uncertainty.
[56] theoretically shows that the norm of neuron weights ( e.g. , classifier) matters for its Rademacher complexity.
As a trivial solution to minimize the CE loss, increasing the classifier norm (if the feature is correctly classified) can easily decrease the CE loss to zero for this sample, which is mostly caused by the softmax function.
Taking both feature and class proxy norm into account greatly complicates the analysis ( e.g. , it results in weighted hyperspherical energy where the potentials between vectors are weighted) and seem to yield little benefit for now.
We defer this issue to future investigation.
HUG as a general framework for designing loss functions .
HUG can be viewed as an inherently decoupled way of designing new loss functions.
As long as we design a measure of hyperspherical uniformity, then HUG enables us to effortlessly turn it into a loss function for neural networks.
E XPERIMENTS AND R ESULTS
Our experiments aims to demonstrate the empirical effectiveness of HUG, so we focus on the fair comparison to the popular CE loss under the same setting.
Experimental details are in Appendix N.
4. E XPLORATORY E XPERIMENTS AND A BLATION S TUDY
[Table] [Table]
[Table]
Different HUG variants .
We compare different HUG variants and the
CE loss on CIFAR-10 and CIFAR-100 with ResNet-18 [29].
Specifically, we use Eq.
6, Eq. 6 and Eq.
10 for MHE-HUG, MHS-HUG and MGD-HUG, respectively.
The results are given in Table 1.
We can observe that all HUG variants outperform the CE loss.
Among all, MHE-HUG achieves the best testing accuracy with considerable improvement over the CE loss.
We note that all HUG variants are used without the CE loss.
The performance gain of HUG are actually quite significant, since the CE loss is currently a default choice for classification problems and serves as a very strong baseline.
[Table]
Different methods to update proxies .
We also evaluate how different proxy update methods will affect the classification performance.
We use the same setting as Table 1.
For all the proxy update methods, we apply them to MHE-HUG (Eq. 6) under the same setting.
The results are given Table 2.
We can observe that all the propose proxy update methods work reasonably well.
More interestingly, static proxies work surprisingly well and outperform the CE loss even when all the class proxies are randomly initialized and then fixed throughout the training.
The reason the static proxies work for MHE-HUG is due to Proposition 1.
This result is significant since we no longer have to train class proxies in
HUG (unlike CE).
When trained with large number of classes, it is GPU-memory costly for learning class proxies, which is also known as one of the bottlenecks for face recognition [1].
HUG could be a promising solution to this problem.
[Figure]
Loss landscape and convergence .
We perturb neuron weights (refer to [40]) to visualize the loss landscape of HUG and CE in Figure 4.
We use MHE in HUG here.
The results show that HUG yields much flatter local minima than the CE loss in general, implying that HUG has potentially stronger generalization [34, 57].
We show more visualizations and convergence dynamics in Appendix O.
[Figure]
[Table]
Learning with different architectures .
We evaluate HUG with different network architectures such as VGG-16 [65],
ResNet-18 [29] and DenseNet-121 [31].
Results in Table(Left number: CIFAR-10, right number: CIFAR-100) show that HUG is agnostic to different network architectures and outperforms the CE loss in every case.
Although HUG works well on its own, any other methods that improve CE can also work with HUG.
4. G ENERALIZATION AND R OBUSTNESS UNDER D IFFERENT L EARNING S CENARIOS
[Table]
Long-tailed recognition .
We consider the task of long-tailed recognition, where the data from different classes are imbalanced.
The settings generally follow [6]
[Table]
and the dataset gets more imbalanced if the imbalance ratio (IR) gets smaller.
The potential of HUG in imbalanced classification is evident, as the inter-class separability in the HUG is explicitly modeled and can be easily controlled.
Experimental results in Table 4 show that HUG can consistently outperform the CE loss in the challenging long-tailed setting under different imbalanced ratio.
[Table]
Continual learning .
We demonstrate the potential of
HUG in the class-continual learning setting, where the training data is not sampled i.i.d.
but comes in class by class.
Since training data is highly biased, hyperspherical uniformity among class proxies is crucial.
Due to the decoupled nature of HUG, we can easily increase the importance of inter-class separability, unlike
CE.
We use a simple continual learning method – ER [62] where the CE loss with memory is used.
We replace it with HUG.
Table 5 shows HUG consistently improves ER under different memory size.
[Table]
Adversarial robustness .
We further test HUG’s adversarial robustness.
In our experiments, we consider the classical white-box PGD attack [51] on ResNet18.
The PGD attack iteration is set as 100 and the attack strength level is set as 2/255, 4/255, 8/255 in l ∞ norm.
All networks are naturally training with either HUG or CE loss.
Results in Tabledemonstrate that HUG yields consistently stronger adversarial robustness than the CE loss.
[Table]
NLP tasks .
As an exploration, we evaluate HUG on some simple NLP classification tasks.
Our experiments follow the same settings as [32] and finetune the BERT model [15] in these tasks.
Table 7 shows that HUG yields better generalizability than CE, demonstrating its potential for NLP.
R ELATED W ORK AND C ONCLUSION (M AIN P APER E NDS AT P AGE 9)
We start by generalizing and decoupling the NC phenomenon, obtaining two basic principles for loss functions.
Based on these principles, we identify a quantity hyperspherical uniformity gap, which not only decouples NC but also provides a general framework for designing loss functions.
We demonstrate a few simple HUG variants that outperform the CE loss in terms of generalization and adversarial robustness.
There is a large body of excellent work in NC that is related to HUG, such as [26, 33, 71, 89].
[88] extends the study of NC to more practical loss functions ( e.g. , focal loss and losses with label smoothing).
Different from existing work in hyperspherical uniformity [41, 45, 48] and generic diversity (decorrelation) [2, 7, 11, 54, 77, 83], HUG works as a new learning target (used without CE) rather than acting as a regularizer for the CE loss (used together with CE).
Following the spirit of [32], we demonstrate the effectiveness and potential of HUG as a valid substitute for CE.
[Figure]
Relevant theoretical results .
[87] has discussed NC under the case of d<C − 1 , and shown that the global solution in this case yields the best rand- d approximation of the simplex ETF.
Along with [87],
GNC gives a more profound characterization of the convergence of class-means.
We show a special case of d =2 , C =4 .
It is easy to see that hyperspherical uniformity in this case forms four vectors with adjacency ones being perpendicular.
This is also the case captured by the best rank- 2 approximation ( i.e. , a 2-dimensional hyperplane with simplex ETF projected onto it).
Figure 5 gives a geometric interpretation for the connection between [87] and GNC.
[3] provides an in-depth introduction and comprehensive theoretical analysis for the energy minimization problem, which significantly benefit this work.
Connection to contrastive learning .
The goal of contrastive learning [8, 10, 24, 30, 72, 78, 85] is to learn discriminative features through instance-wise discrimination and contrast.
Despite the lack of class labels, [78] discovers that contrastive learning performs sample-wise alignment and sample-wise uniformity, sharing a similar high-level spirit to intra-class variability and inter-class separability.
[35] adapts contrastive learning to the supervised settings where labeled samples are available, which also shares conceptual similarity to our framework and settings.
Related work on (deep) metric learning .
Metric learning also adopts similar idea where similar samples are pulled together and dissimilar ones are pushed away.
HUG has intrinsic connections to a number of loss functions in metric learning [4, 17, 21, 24, 58, 59, 61, 67, 68, 79, 79–81, 84].
B ROAD I MPACT AND F UTURE W ORK
Our work reveals the underlying principle – hyperspherical uniformity gap, for classification loss function, especially in the context of deep learning.
We provide a simple yet effective framework for designing decoupled classification loss functions.
Rather than previous objective functions that are coupled and treated as a black-box, our loss function has clear physical interpretation and is fully decoupled for different functionalities.
These characteristics may help neural networks to identify intrinsic structures hidden in data and true causes for classifying images.
HUG could have broader applications in interpretable machine learning and fairness / bias problems.
Our work is by no means perfect, and there are many aspects that require future investigation.
For example, the implicit data mining in CE [49] is missing in the current HUG design, current HUG losses are more sensitive to hyperparameters than CE (the flexibility of decoupling also comes at a price), current HUG losses could be more unstable to train (more difficult to converge) than CE, and it requires more large-scale experiments to fully validate the superiority of current HUG losses.
We hope that our work can serve as a good starting point to rethink classification losses in deep learning.
A CKNOWLEDGEMENT
The authors would like to sincerely thank the anonymous reviewers for all the detailed and valuable suggestions that have significantly improved the paper.
This work is supported by the German
Federal Ministry of Education and Research (BMBF): Tübingen AI Center, FKZ: 01IS18039A, 01IS18039B; and by the Machine Learning Cluster of Excellence, EXC number 2064/1 – Project number 390727645.
AW acknowledges support from a Turing AI Fellowship under EPSRC grant
EP/V025279/1, and the Leverhulme Trust via CFI.
I Proof of Proposition
J
Proof
of Proposition
K Proof of Proposition
L Derivation of CE’s Lower Bound
M Proof of Theorem
N Experimental Details
O Additional Experimental
Results
A E MPIRICAL R ESULTS ON G ENERALIZED N EURAL C OLLAPSE A. D ETAILED M ETRIC D EFINITION
We consider four metrics: average classifier energy (ACE), average class-mean energy (ACME), average feature reverse-energy (AFRE) and average feature-mean reverse-energy (AFMRE) in the paper.
Their definitions are given below:
[Equation]
where | A c | denotes the cardinality of the set
A c , ˆ µ c is the normalized feature mean of the c -th class and ˆ w c denotes the normalized class proxy of the c -th class.
A. E MPIRICAL R ESULTS OF GNC ON I MAGE N ET
We find that the GNC hypothesis remains valid and informative even under the scenario of large number of classes (we use the 1000-class ImageNet-2012 dataset [13] here).
Experimental results with ResNet-18 [29] (feature dimension as 512) are given in Figure 6.
Experimental results with
ResNet-50 [29] (feature dimension as 2048) are given in Figure 7.
[Figure]
e r a g e
H yp
[Figure]
r s
[Figure]
r i ca l
[Figure] [Figure]
g e
H yp e r s ph e
r
i ca l
E n
[Figure]
r gy
[Figure]
B 2D MNIST F EATURE V ISUALIZATION
We also visualize the 2D MNIST feature in Figure 8, Figure 9 and Figure 10, which is done by directly setting the output feature dimension as 2.
Different color denotes different class and black arrow denotes the class proxy.
We compare the difference between the CE loss and the HUG-MHE loss (with either independently optimized proxies or fully learnable proxies).
Specifically, for the HUG-MHE loss with independently optimized proxies, we use the following form:
[Figure]
[Equation] where we stop the gradient for the class proxies in the intra-class hyperspherical uniformity term. Form the results, we observe that the our HUG losses generally learns better representations than the CE loss
[Figure]
and moreover, HUG learns more aligned class proxy and class feature-mean than CE.
[Figure]
[Figure] [Figure] [Figure]
[Figure]
C O THER V ARIANTS IN THE HUG F RAMEWORK
There are plenty of interesting and useful instantiations for the loss function under the HUG framework.
In this section, we discuss a few highly relevant and natural ones.
C. P ROXY - FREE HUG
We have the following general HUG objective function:
[Equation]
where we can have many possible instantiations.
Other than the proxy-based form proposed in the main paper, we can also have a proxy-free version:
[Equation]
) where { ˆ x i ∈ A c } Cc =1 denotes a set of vectors that consist of one random sample per class.
This is essentially to replace the class proxy with a random sample from this class.
The proxy-free HUG loss can be used in the scenario where extremely large amount of classes exist and storing class proxies can be very expensive, or in the scenario of self-supervised contrastive learning where each instance and its augmentations are viewed as one class.
A MHE-based instantiation of Eq.
18 is given by
[Equation]
which can be similarly relaxed to
[Equation]
where ˆ x i ∈ A c denotes a randomly selected sample from the c -th class.
The first term in Eq.
20 can also be viewed as a scalable stochastic approximation to the first term in the following loss function:
[Equation]
which is typically optimized by stochastic gradients (samples come as a mini batch) in practice
[Equation]
C. C OUPLED HUG
One advantage of HUG is that it decouples intra-class variability and inter-class separability.
However, coupling may also bring some benefits ( e
[Equation]
g. , robustness on hyperparameters, stability in training).
To this end
[Equation]
we also propose a coupled loss function using the HUG framework:
[Equation]
[Table]
[Equation]
[Table]
[Equation]
which can be turned into a MHE-based instantiation:
[Equation]
where the first term itself couples intra-class and inter-class hyperspherical uniformity.
Although the coupled HUG drops the flexibility that the original HUG framework brings, it may introduce extra advantages ( e.g. , training stability).
C. HUG WITHOUT H YPERSPHERICAL N ORMALIZATION
While the CE loss does not necessarily require hyperspherical normalization for the proxies and features (but hyperspherical normalization does improve CE’s generalizability [44, 75]), we also consider the HUG framework without hyperspherical normalization here.
We note that this issue remains an open challenge and we only aim to provide some simple yet natural designs.
The obvious problem to remove hyperspherical normalization is that HUG has a trivial way to decrease its loss – simply increasing the magnitude of features and proxies.
A naive way to address this is to introduce magnitude penalty terms for the features and proxies.
This results in
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
where s denotes the magnitude hyperparameter.
D P ROOF OF T HEOREM
We first let ˆ V C
= { ˆ v 1 , · · · , ˆ v C } be an arbitrary vector configuration in S d − 1 .
Then we will have that
[Equation]
which holds if and only if (cid:80) Ci =1 ˆ v i = 0 .
The vertices of a regular ( n − 1) -simplex at the origin well satisfy this condition.
With the properties of the potential function f , we have that
[Equation]
which holds true if all pairwise distance ∥
ˆ v i − ˆ v j ∥ are equal for i ̸
= j and the center of mass is at the origin ( i.e. , (cid:80) Ci =
1 ˆ v i = 0 ).
Therefore, for the vector configuration ˆ V ∗ C which contains the vertices of a regular ( C − 1) -simplex inscribed in S d and centered at the origin, we have that for 2 ≤ C ≤ d +
[Equation]
If f is strictly convex and strictly decreasing, then E f ( ˆ V C ) ≥ C ( C − 1) f
( 2 CC − 1 ) holds only when ˆ V ∗ C is a regular ( C − 1) -simplex inscribed in S d − 1 and centered at the origin.
■
E P ROOF OF T HEOREM
This result comes as a natural conclusion from [12] where they prove that any sharp code is a minimal hyperspherical f -energy N -point configuration for any interaction potential f that is absolutely monotone on [ − 1 , 1] including all Riesz s -potentials f
( t ) = 2( t − 2 t ) − s/ 2 for s > 0 .
Before we move on, we need to introduce the definition of sharp code:
Definition 1 Let ˆ V N =
ˆ v 1 , · · · , ˆ v N } be a N -point configuration on S d ′ .
• If for every ( d ′ + 1) -variate polynomial P of degree at most m ,
[Equation]
then ˆ V N is called a spherical m -design.
• If ˆ V N is a configuration of N distinct points such that the set of inner products between distinct points in ˆ V N has cardinality k , then ˆ V N is called a spherical k -distance set.
• The configuration ˆ V N is a sharp code if it is both a k -distance set and a spherical (2 k − 1) - design.
The Cohn-Kumar Universal Optimality theorem [12] states that any sharp code is universally optimal.
By universal optimality, we mean that
Definition 2 An N -point configuration ˆ V N on S d ′ is called universally optimal if
[Equation]
holds for any absolutely monotone function f : [ − 1 , 1) → R .
Then formally, Cohn-Kuma Universal Optimality Theorem states:
Theorem 6 If ˆ V N is a sharp code on S d ′ , then ˆ V N is universally optimal.
Because the vertices of the cross-polytope are a sharp code, then this vertex set ( 2 d ′ + 2 points in total) is universally optimal, which implies that
[Equation]
(27) where ˆ W N denote the vertex set of the cross-polytope.
Then we let s = 2 for the f -energy and d ′ =
d − 1 , and we prove our theorem.
■
F P ROOF OF T HEOREM
This theorem is in fact a well-known result (see [3, 27, 38, 63]).
This general result is stated as
Theorem 7 If A ⊂ R p is compact with dim A > 0 and 0 < s < dim A , then
[Equation]
N
[Equation]
=
W s ( A )
[Equation]
where ε s ( A, n ) :
=
min
ˆ W n ⊂ A E s ( ˆ W n ) and W s ( A ) is Wiener constant.
Moreover, the equilibrium measure µ s,A on A is unique for the Riesz s -kernel when 0 < s < dim A .
Finally, any sequence { ˆ v N 1 , · · · , ˆ v NN } ∞ N =2 of asympototically s -energy minimizing N -point configuration on A satisfies
[Equation]
From the theorem above, with s = 2 , d − 1 > s , N = C and A = S d − 1 , we have that W s ( S d − 1 ) is a constant term, and most importantly, we have that these point sequences { ˆ µ C 1 , · · · , ˆ µ CC } asymptotically minimizes the hyperspherical energy on S d − 1 .
Moreover, the same theorem also gives that the leading term of the minimum hyperspherical energy is of order O ( n 2 ) as n → ∞ .
■
G P ROOF OF P ROPOSITION
We show that zero-mean equal-variance Gaussian distributed vectors (after normalized to norm 1 ) are uniformly distributed over the unit hypersphere with Theorem 8.
Lemma 1 Let x be a n -dimensional random vector with distribution N (0 , 1) and U ∈ R n × n be an orthogonal matrix ( UU ⊤ =
U ⊤ U
= I ).
Then Y =
Ux also has the distribution of N (0 , 1) .
Proof G.1 For any measurable set A ⊂ R n , we have that
[Equation]
because of orthogonality of U .
Therefore the lemma holds.
■
Theorem
The normalized vector of Gaussian variables is uniformly distributed on the sphere.
Formally, let x 1 , x 2 , · · · , x n ∼ N (0 , 1) and be independent.
Then the vector
[Equation] [Equation]
follows the uniform distribution on S n − 1 , where z = (cid:112) x
21 + x 22 + · · · + x 2 n is a normalization factor.
Proof G.
A random variable has distribution N (0 , 1) if it has the density function
[Equation]
A n -dimensional random vector x has distribution N (0 , 1) if the components are independent and have distribution N (0 , 1) each.
Then the density of x is given by
[Equation]
Then we use Lemma 1 about the orthogonal-invariance of the normal distribution.
Because any rotation is just a multiplication with some orthogonal matrix, we know that normally distributed random vectors are invariant to rotation.
As a result, generating x ∈ R n with distribution N (0 , 1) and then projecting it onto the hypersphere S n − 1 produces random vectors U = x
∥ x ∥ that are uniformly distributed on the hypersphere.
Therefore the theorem holds.
■
The above results indicate that as long as class proxies are initialize with zero-mean Gaussian, they are uniformly distributed over the hypersphere in a probabilistic sense.
■
H D ERIVATION OF HUG S URROGATE FOR MHE AND MHS
The derivation of L ′ MHE-HUG is as follows:
[Equation]
The derivation of L ′ MHS-HUG is as follows:
[Equation]
Most importantly, (cid:80) c
[Equation]
∥ in L MHS
[Equation]
HUG and L ′ MHS-HUG share the same minimizer (minimum is 0 , which happens when intra-class feature collapse to its class proxy).
Therefore, L ′ MHS-HUG and L MHS-HUG share the same maximizer, and L ′ MHS-HUG can be viewed as a surrogate loss for L MHS-HUG .
I P ROOF OF P ROPOSITION
For notational convenience, we first define ε s ( S d − 1 , n ) :
=
min ˆ V n ⊂ S d − 1 E s ( ˆ V n ) and δ ρn ( S d − 1 ) :
= max ˆ V n ⊂ S d − 1 ϑ ( ˆ V n ) .
We then define that ˆ V sn is a s -energy minimizing n -point configuration on S d −if 0 < s < ∞ ( i.e. , MHE configuration) and ˆ V ∞ n denotes a best-packing configuration on S d − 1 if s = ∞ ( i.e. , MHS configuration).
Since we are considering s > 0 , we only need to discuss the case of K s (ˆ v i , ˆ v j )
=
ρ (ˆ v i , ˆ v j ) − s .
Then we will have the following equation:
[Equation] [Equation]
Moreover, we have that
[Equation]
Therefore, we will end up with
[Equation]
Then we take both Eq.
34 and Eq.
36 into consideration and have that
[Equation]
1 ) (37) which concludes the proof.
■
J P ROOF OF P ROPOSITION
We write down the formulation of the HUG objectives (with MHE):
[Equation]
For both objectives, we can see that the minimizer of the second term ( i.e. , the intra-class variability term) is all intra-class feature collapse to their class proxy and therefore the second term achieves the global minimum 0 .
For the first term of both objectives, the global minimizer can be obtain directly from Theorem 1,
Theorem 2 and Theorem 3.
It is easy to see that the global minimizer of the inter-class separability term and the intra-class variability term does not contradict with each other and can be achieved simultaneously.
■
K P ROOF OF P ROPOSITION
n (cid:88) i = log
[Equation]
1 ̸
[Equation]
≥ n
[Equation]
i =
C
[Equation]
=1 ̸ = y
i
[Equation]
≥ n (cid:88)
[Equation]
=
[Equation]
(cid:88) j =1 ̸ = y
i
[Equation] [Equation]
= n (cid:88) i =
C (cid:88)
j ̸ = y i ⟨
[Equation]
(cid:124) (cid:123)(cid:122) (cid:125)
[Table]
IS and IV − ( C
[Equation]
1) n (cid:88) i = ⟨
[Equation]
[Equation]
(cid:124) (cid:123)(cid:122) (cid:125)
[Table]
Variability
[Equation]
n (cid:88)
i = log
[Equation] [Equation]
C (cid:88)
j =1 ̸ = y
i
[Equation] [Equation]
i
[Equation] [Equation]
y
[Equation]
, x i ⟩ )) ≤ log(1 + n (cid:88) i =
C (cid:88)
j =1 ̸ = y i exp( ⟨ w j , x i ⟩ − ⟨ w y i , x i ⟩ )) ≤ log(1 + n (cid:88) i =
C (cid:88)
j =1 ̸ =
y i (exp( ⟨ w j , x i ⟩ ) + exp( −⟨ w y i , x i ⟩ )))
= log (cid:0) 1 + n (cid:88)
i =
C (cid:88)
j ̸ = y i exp( ⟨ w j , x
[Equation]
■
L D ERIVATION OF CE’ S L OWER B OUND
The derivation is actually very simple and this result is originally given by [4].
We find that it naturally matches the intuition behind HUG.
For our paper to be self-contained, we briefly give the simple derivation below.
For the details, please refer to Proposition 1 in [4].
We start by rewriting the CE loss as
[Equation]
where λ can be chosen such that both Q 1 ( w ) and Q 2 ( w ) become convex functions with respect to w .
Taking advantage of the convexity
[Equation]
we can separately set the gradient of Q 1 ( w ) and Q 2 ( w ) with respect to w as 0 and compute their minima.
Specifically
[Equation]
we end up with
[Equation]
n
[Equation]
i =
l ic
[Equation]
(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) , (44) where l ic = exp( ⟩ w c , w i ⟩ ) (cid:80) j exp( ⟨ w j , x i ⟩ ) denotes the softmax confidence.
Combining the two lower bounds above, we can have that
L
[Equation]
c
[Equation]
(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)
[Equation]
n
[Equation]
(cid:88)
i
[Equation]
l ic
[Equation]
(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) −2 λn n (cid:88) i = (cid:88)
[Equation]
yi
[Equation]
(45) where the first two terms encourage larger inter-class hyperspherical uniformity, and the last term promotes smaller intra-class hyperspherical uniformity.
M P ROOF OF T HEOREM
This theorem follows naturally from the main result in [50].
[50] has proved that the minimizer of a simplified form of the cross-entropy loss is the simplex ETF when 2 ≤ C ≤ d + 1 and the minimizer also asymptotically converges to uniform measure on the hypersphere.
More formally, we have
Theorem 9 ([50]) Consider the following variational problem
[Equation]
Let µ n be the probability measure on S d generated by a minimizer
[Equation]
then for any α > 0 , µ n converges weakly to the unform measure on S d − 1 as n → ∞ .
From Theorem 3, we know that HUG with specific potential energy also converges to the uniform measure on S d − 1 .
Combining the results above, we can conclude that HUG and CE shares the same minimizer.
■
N E XPERIMENTAL D ETAILS
General settings .
For the MHE-HUG and MHS-HUG, the α and β are set as 0.15 and 0.015, respectively.
For the MGD-HUG, the α and β are set as 0.15 and 0.03, respectively.
We train the model for 200 epochs with 512 batchsize for both the cross-entropy (CE) loss and HUG.
We use the stochastic gradient descent with momentum of 0.9, weight decay of 2 × 10 − 4 .
The initial learning rate is set as 0.1 for CIFAR-100 and CIFAR-10 and is decayed by 0.1 with step learning rate scheduler at 60, 120, 180 epoch.
For the general classification experiments, different architectures of ResNet-18,
VGG16 and DenseNet121 are considered.
we use the simple data augmentation: 4 pixels are padded on each side, and image is randomly cropped.
Long-tailed recognition.
We follow LDAM [6] to obtain imbalanced CIFAR-10 and CIFARdatasets with different kinds of imbalanced ratio.
Following LDAM, we use ResNet-32 as our base network.
The other setting is set as the same as our general setting.
Continual learning.
We follow the DER [5] to construct our continual learning experiments.
We split the whole CIFAR-10 and CIFAR-100 training set into 5 tasks.
Each task has 2 classes andclasses for CIFAR-10 and CIFAR-100, respectively.
The training batchsize is set as 64, 32 for the incoming data and 32 for the replayed data.
Different size of memory buffer is considered.
Adversarial robustness.
For the experiments of adversarial robustness, we first acquire the model trained with CE and HUG.
By obtain the information of the attacked model, PGD [51] trains some adversarial examples to mislead the attacked model.
The test accuracy in the experiments of adversarial robustness shows the accuracy of the pertubed samples.
Visualizing loss landscape.
We perturb neuron weights to visualize the loss landscape, as proposed in [40].
For a detail, we perturb the model weight with 400 interpolation points in two random vectors of the section [-0.4, 0.4] around the model weight minima.
Also, for a fair comparison, we visualize the perturbed loss value between its minimal value and 4 times minimal value around the Z axis.
O A DDITIONAL E XPERIMENTAL R ESULTS
Training convergence.
We observe the training convergence of HUG in CIFAR-10 and CIFAR-100.
Both the evaluation accuracy and the training loss, including the overall losses, the intra-class loss and the inter-class loss, are showing in the Figure 11.
For both the CIFAR-10 and CIFAR-100, the inter-class loss are relatively small and easy to optimized.
This is in accordance with the Neural
Collapse [60], where the intra-class variability dominates the training process.
Moreover, we find the intra-class loss or the intra-class variability dominate in CIFAR-100 dataset severely and hard to optimize when the class number become large.
This is in accordance with the intuition that classification with large class numbers would be difficult
[Figure]
2D loss contour.
We also utilize the work [40] to visualize the 2D loss landscape, which is more easy to visualize the flatness of the loss landscape.
As shown in the Figure 12, all the 2D loss landscape of our overall loss, the intra-class loss and the inter-class loss are more flatter than the popular used CE loss, showing that HUG are easier to find flat minima which has better generalization ability
[Figure]
[Table]
The ablation of α and β .
In our HUG framework, we introduce two loss scale, α for the interclass hyperspherical uniformity, β for the intra-class hyperspherical uniformity.
We investigate the influence of the two loss scale to the model performance.
As shown in the Table 8.
HUG is not sensitive to α , as the inter-class hyperspherical uniformity is always easy to optimize.
HUG is also not sensitive to the β , when it at the right range.
The ablation experiments are conducted on the
CIFAR-100 dataset, α is set as 0.15 when conducting ablation on β .
When conducting ablation on α , β is set as 0.015.
[Table]