Source-linked AI summary

The Singular Values of Convolutional Layers

Hanie Sedghi, Vineet Gupta, Philip M. Long

arXiv:1805.10408v2cs.LGcs.AIstat.ML

TL;DR

Exploding and vanishing gradients motivate studying the singular values of convolutional layers, which also affect forward computational stability. The paper characterizes these singular values exactly through Fourier and matrix computations, enabling fast evaluation and operator-norm projection; on CIFAR-10, the regularizer improves test error from 6.2% to 5.3%.

  • Problem

    Singular values of convolutional layers are important for gradient and forward-signal scaling, but prior methods used approximations to control their operator norms.

  • Method

    The paper characterizes multi-channel convolutional singular values using block-circulant structure, Fourier transforms, and small channel-wise singular-value decompositions.

  • Results

    6.2% to 5.3%: operator-norm projection improves deep residual-network test error on CIFAR-10, including with batch normalization.

  • Takeaways & Limitations

    The characterization computes singular values exactly in O(n^2m^2(m + log n)) time, making full-spectrum computation and operator-norm regularization practical.

  • Takeaways & Limitations

    The reported comparison uses only one dataset, so its results may not generalize to other datasets.

Abstract

from arXiv · show

We characterize the singular values of the linear transformation associated with a standard 2D multi-channel convolutional layer, enabling their efficient computation. This characterization also leads to an algorithm for projecting a convolutional layer onto an operator-norm ball. We show that this is an effective regularizer; for example, it improves the test error of a deep residual network using batch normalization on CIFAR-10 from 6.2\% to 5.3\%.

1 Introduction

The paper studies exact singular values of multi-channel convolutional layers because they govern gradient and forward-signal scaling, then uses a Fourier-based characterization to compute them efficiently and support operator-norm regularization.

  • Motivation: Convolutional-layer singular values matter because they bound how much a layer scales backpropagated gradients and forward signals, affecting exploding, vanishing, and unstable computations.Keeping singular values near 1 makes gradients neither explode nor vanish.
  • Problem setting: The paper analyzes standard image convolutions as linear transformations parameterized by a k × k × m × m kernel, assuming stride 1 and equal input-output channel counts for exposition.The analysis uses torus-like wraparound boundary behavior, while practical layers may instead crop outputs or zero-pad inputs.
  • Results: The characterization computes all singular values in O(n^2m^2(m + log n)) time, versus O(n^6m^3) for brute-force SVD of the full transformation matrix.The proposed computation is also comparable in structure to the O(n^2m^2k^2) cost of applying the convolution itself.
  • Results: Timing tests find multiple-orders-of-magnitude speedups, with FFTs and SVDs parallelizable and the TensorFlow implementation faster than the NumPy implementation.The authors attribute the TensorFlow speed advantage to parallelism and apply the code to convolutional layers in the official TensorFlow ResNet-v2 model.
  • Regularization: Projecting layers onto an operator-norm ball improves CIFAR-10 test error from 6.2% to 5.3%, including when batch normalization is present.The paper reports that operator-norm regularization and batch normalization are complementary rather than redundant.
  • Analysis: In the multi-channel case, the convolutional transformation has a three-level block-circulant structure whose Fourier eigenvectors reduce singular-value computation to smaller channel-wise problems.The method uses 2D Fourier transforms to obtain eigenvalues of doubly circulant matrices and then forms m × m matrices for each spatial frequency.

2 Analysis

The analysis represents convolutional transformations with structured circulant matrices and uses Fourier transforms to characterize their singular values exactly, including the multi-channel case.

  • 2.1 One filter: A single-channel 2D convolution is represented by a doubly block circulant matrix, extending the circulant structure of 1D convolution.The matrix is a circulant matrix of circulant blocks, and vectorization gives vec(Y) = A vec(X).
  • 2.2 Multi-channel convolution: The analysis reduces the convolutional spectrum to independent channel-space singular-value problems after Fourier diagonalization.The unitary Fourier structure preserves singular values while separating spatial frequencies.
  • 2.1 One filter: For one filter, the eigenvalues are the entries of F^T K F, and the singular values are their magnitudes.The matrix is normal, so its singular values equal the magnitudes of its eigenvalues; F^T K F is the 2D Fourier transform of K.
  • 2.2 Multi-channel convolution: In the multi-channel case, each channel-to-channel component is a doubly block circulant matrix, and the full transformation is assembled from these components.Each output channel can be viewed as a sum of single-channel filters parameterized by the corresponding kernel slices.
  • 2.2 Multi-channel convolution: The multi-channel singular values are obtained from m × m matrices P(u,v) formed at each 2D Fourier frequency.The proof transforms the block structure into diagonal blocks, reshapes their nonzero entries into channel matrices, and combines the singular values across frequencies.

3 Regularization

The characterized spectrum enables operator-norm control by projecting convolutional layers onto bounded-norm sets, with alternating projections used in practice during training.

  • 3 Regularization: The projection onto an operator-norm ball clips the singular values of the convolutional linear transformation to [0, c].The singular vectors remain unchanged, so the projected matrix is still generated by a convolution.
  • 3 Regularization: The operator-norm projection can enlarge the convolution neighborhood to n × n, so a second projection can restore a k × k neighborhood.Alternating the two projections targets the intersection of bounded operator norm and bounded spatial support.
  • 3 Regularization: In iterative optimization, the authors apply the two projections once every few steps rather than repeatedly alternating them to convergence.They report that the first two projections often produce an operator norm close to the desired value and provide a warm start for subsequent projections.

4 Experiments

Experiments validate the exact singular-value computation against full-matrix SVD and evaluate operator-norm projection for CIFAR-10 ResNet training, including robustness and batch-normalization comparisons.

  • The implementation was validated by comparing its singular values with those obtained from the full matrix encoding and SVD.
  • TensorFlow became much faster than NumPy for larger tensors by exploiting algorithmic parallelism on a GPU.For small tensors, NumPy was faster; the timing results appear in Figure 1.
  • 6.2% baseline test error fell to 5.3% when convolutional operator norms were clipped to 0.5 every 100 steps.Clipping to 0.1 produced 6.7%, while clipping to 1.0 produced 5.5%; projections did not slow training very much.
  • 4.3 Robustness to changes in hyperparameters: Operator-norm regularization improved the best result and made training more robust to hyperparameter choices without batch normalization.The experiment evaluated 150 hyperparameter combinations.
  • 4.3 Robustness to changes in hyperparameters: Operator-norm regularization helped even with batch normalization, and the two methods appeared nonredundant.The authors report that neither regularizer dominated the other.
  • 4.4 Comparison with reshaping K: Clipping singular values of reshaped K every 100 steps matched the best accuracy from exact operator-norm clipping, while per-step clipping was slightly worse.On the same machine, exact clipping was also about 25% faster in the reported per-step comparison.
  • 4.4 Comparison with reshaping K: The comparison used one dataset, so its results may not generalize to other datasets.

A NumPy code for operator norm projection

The NumPy projection computes Fourier-domain singular values, clips them to a specified threshold, reconstructs the transformed kernel, and returns the cropped real kernel.

  • The function transforms the kernel with a 2D FFT and computes an SVD of the transformed coefficients.
  • It clips each singular value elementwise to the requested operator-norm threshold.
  • The clipped coefficients are reconstructed with matrix multiplication, inverse-transformed by FFT, and cropped back to the original kernel shape.

B Test error vs. training time

Figure 4 compares CIFAR-10 ResNet test error against training time to assess the training-time impact of the projections.

  • Figure 4 plots test error against training time for the CIFAR-10 ResNet experiment.

C The official pre-trained ResNet model

The pretrained ResNet V2 convolutional layers show substantial variation in singular-value spectra, with effective rank generally larger near the inputs and non-negligible singular values tapering later.

  • Figure 5 orders singular values by value and plots only convolutional layers with kernels larger than 1 × 1.
  • As processing proceeds through the layers, the number of non-negligible singular values initially increases and then tapers off near the end.
  • Most layers have at least 10000 singular values that are at least 1, although the first layer’s singular values are much larger than the rest.
  • The effective rank of the convolutional layers is larger closer to the inputs when singular values are normalized by each layer’s maximum.
  • Figure 7 normalizes the horizontal axis by the total number of singular values to account for differences in layer size.
Loading 1805.10408v2…