[Paper Review] Cosine Normalization: Using Cosine Similarity Instead of Dot Product in Neural Networks
This paper proposes cosine normalization, a novel technique that replaces the dot product with cosine similarity or centered cosine similarity (Pearson correlation coefficient) in neural networks to bound neuron activations and reduce variance. Experiments across MNIST, 20NEWS, CIFAR-10/100, and SVHN show cosine normalization achieves lower test error and greater stability than batch, weight, and layer normalization, with centered cosine (PCC) yielding the best performance.
Traditionally, multi-layer neural networks use dot product between the output vector of previous layer and the incoming weight vector as the input to activation function. The result of dot product is unbounded, thus increases the risk of large variance. Large variance of neuron makes the model sensitive to the change of input distribution, thus results in poor generalization, and aggravates the internal covariate shift which slows down the training. To bound dot product and decrease the variance, we propose to use cosine similarity or centered cosine similarity (Pearson Correlation Coefficient) instead of dot product in neural networks, which we call cosine normalization. We compare cosine normalization with batch, weight and layer normalization in fully-connected neural networks as well as convolutional networks on the data sets of MNIST, 20NEWS GROUP, CIFAR-10/100 and SVHN. Experiments show that cosine normalization achieves better performance than other normalization techniques.
Motivation & Objective
- To address the problem of unbounded neuron activation variance in deep neural networks, which leads to poor generalization and internal covariate shift.
- To reduce sensitivity to input distribution shifts by bounding pre-activation values within [-1, 1] using similarity-based normalization.
- To develop a normalization technique independent of batch statistics, enabling consistent training and inference without batch-dependent computation.
- To evaluate the effectiveness of cosine normalization and centered cosine normalization (PCC) against established normalization methods across diverse architectures and datasets.
Proposed method
- Replace the standard dot product $ \mathbf{w} \cdot \mathbf{x} $ with cosine similarity $ \cos\theta = \frac{\mathbf{w} \cdot \mathbf{x}}{\|\mathbf{w}\| \|\mathbf{x}\|} $, which normalizes the activation to the [-1, 1] range.
- Use centered cosine similarity (Pearson correlation coefficient) as an alternative, which further removes mean bias and improves stability.
- Apply the normalization directly in the forward pass, eliminating dependence on batch or layer statistics, enabling consistent behavior at train and test time.
- Implement the method in both fully-connected and convolutional networks, normalizing over receptive fields in convolutions.
- Train using standard backpropagation, with gradients computed through the cosine similarity operation.
- Ensure the method is differentiable and compatible with standard optimization algorithms like SGD and Adam.
Experimental results
Research questions
- RQ1Can replacing the dot product with cosine similarity reduce activation variance and improve model generalization in deep neural networks?
- RQ2How does cosine normalization compare to batch, weight, and layer normalization in terms of test error and training stability?
- RQ3Does using centered cosine similarity (Pearson correlation coefficient) further improve performance over standard cosine normalization?
- RQ4Can cosine normalization be effectively applied to both fully-connected and convolutional networks without relying on batch statistics?
- RQ5Does cosine normalization enable faster convergence or higher learning rates compared to existing normalization techniques?
Key findings
- Centered cosine normalization (Pearson correlation coefficient) achieved the lowest test error across all datasets: 1.39% on MNIST, 29.37% on 20NEWS, 6.39% on CIFAR-10, 27.49% on CIFAR-100, and 2.22% on SVHN.
- Cosine normalization achieved second-best performance on all datasets, with significantly lower variance than batch normalization, which showed high instability in high-dimensional text tasks like 20NEWS.
- On MNIST, cosine normalization reduced test error to 1.40% (mean), compared to 1.45% for batch normalization and 1.65% for weight normalization.
- On CIFAR-10, cosine normalization achieved 7.33% test error, outperforming batch normalization (8.08%) and weight normalization (8.55%), with lower variance.
- On SVHN, centered cosine normalization achieved 2.22% test error, outperforming batch (2.49%) and layer normalization (2.58%), with minimal variance.
- The method showed consistent performance gains across diverse data types—handwritten digits, text, and natural images—demonstrating broad applicability and robustness.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.