Introduction
The rank of a neural network measures the information flow across layers. This paper studies the behavior of the network rank, focusing on rank deficiency. It establishes a universal monotonic decreasing property of network rank, and uncovers rank deficiency of network blocks and deep function coupling.
Preliminaries
The rank of a function \(f : \mathbb{R}^n \to \mathbb{R}^d\) is the rank of its Jacobian matrix \(J_f\) over its input domain \(X\) . \[\text{Rank}(f) = \text{Rank}(J_f)\]
Handwavy Lemma 1. If f is smooth almost everywhere and \(\text{Rank}(f) = r\) , the data domain X is a manifold embedded in \(\mathbb{R}^n\) , then \(\text{dim}(f(X)) = \text{Rank}(J_{f}) \le r\) .
Stable Numerical Rank: The rank of a large matrix is known to be unstable (small Gaussian perturbations almost always result in full rank matrices). A stable alternative is to count the number of singular values larger than some threshold \(\epsilon\) .
On partial ranks: Calculating full Jacobians is expensive, but we can compute partial ranks (choose K columns of the Jacobian and compute the rank of this sub-matrix). Partial ranks give a lower bound on the actual rank.
Intrinsic Dimension of Feature Manifolds: This is intractable in general, but we can estimate this as the minimum number of principal components in the final feature space to preserve accuracy (upto an epsilon).
Principal of Rank Diminishing
The rank of the functions formed by subsequent layer composition, and the intrinsic dimension of the feature manifolds both decrease monotonically by layer depth:
\[\text{Rank}(f_1) \ge \text{Rank}(f_2 \circ f_1) \ge ... \ge \text{Rank}(f_{F-1} \circ ... \circ f_1) \ge \text{Rank}(F_L)\]
\[\text{dim}(X) \ge \text{dim}(F_1) \ge ... \ge \text{dim}(f_L)\]
In theory, the equality signs could hold, but they don't in practice because most layers have impetuses towards decreasing rank.
Impetuses of Strict Decreasing
Handwavy Theorem 3: If there is a direction in the input feature manifold such that moving in this direction keeps the output invariant, then the intrinsic dimension strinctly decreases. The maximum number of independent directions gives a lower bound on the rank deficit.
For example, normalization is invariant in the normalized direction at each point, so the intrinsic dimension decreases.
Handwavy Theorem 4: With infinite number of layers, the intrinsic dimension of layers converges to 1, as the system stabilizes. The rank drops to 1 exponentially, with speed \(nC^L\) , where \(C \lt 1\) is a positive constant that only depends on \(n\) .
Experiments and Results
All experiments are done with partial ranks with various choices of image patches.
Rank deficiency of Jacobians
The partial rank of Jacobians seems to decrease exponentially. This indicates that the actual rank decreases even sharply.
Intrinsic dimension of the final feature manifold
The intrinsic dimension (at epsilon = 5%) is a lot lower than the ambient dimension (~150 to 200), except for Swin-T. ImageNet has less than 200 intrinsic dimensions if we want ~75% accuracy, which is super interesting to me.
Structural Impetuses
The dimension of the feature manifold, and the rank of the Jacobian, decreases with both FC and Conv layer (5000 to 4900 dims and ~ -1000 rank)
instance normalization induces a much smaller deficit (8200 to 8900). Interestingly, layernorm and groupnorm induce very small deficit (~10dims?).
Consequences
One major consequence of the very low intrinsic dimension of the final feature layer is that the prediction for a class can be obtained from the prediction for other, unrelated classes. This shows that the classes are entangled, and this might be one way that features might generalize poorly.
Remission
Residual layers have close to full rank Jacobians (residual term is small, \(J = I + J_{res}\) ). Thus the Rank Theorem tells us that Residual layers do not lose rank.
BatchNorm layers are shown to slow down the speed of rank dimishing in some specific cases [12, 4].