Error Correction Output Codes for Robust Neural Networks against Weight-errors: A Neural Tangent Kernel Point of View

Anlan Yu, Shusen Jing, Ning Lyu, Wujie Wen, Zhiyuan YanNeurIPS 2024

This paper provides a rigorous theoretical foundation for using Error Correcting Output Codes (ECOC) to protect Deep Neural Networks (DNNs) from hardware-induced weight errors. By leveraging the Neural Tangent Kernel (NTK) framework, the authors move beyond empirical "trial and error" to offer a mathematical guarantee for network robustness.

TL;DR

The authors provide the first theoretical explanation for why non-one-hot output codes improve DNN robustness against weight errors. They derive a robustness threshold based on codeword distance and propose two novel code construction methods that significantly outperform standard one-hot encoding in noisy hardware environments.

What Problem Does This Paper Address?

Modern neural networks almost exclusively use one-hot encoding for classification (e.g., the label "cat" is [1, 0, 0]). While simple, this approach is extremely fragile. If the network is deployed on emerging hardware like Non-Volatile Compute-in-Memory (NVCiM) accelerators, physical defects can cause "weight errors"—permanent shifts in the stored weights.

In these noisy environments, one-hot encoding offers zero error-correction capability. While researchers have previously experimented with classical error-correcting codes (like those used in telecommunications) to replace one-hot layers, there has been no clear theory explaining how these codes interact with the complex internal dynamics of a neural network. This paper bridges that gap.

Methods

The researchers analyze the problem through the lens of the Neural Tangent Kernel (NTK), which allows them to treat infinitely wide neural networks as linear models in a high-dimensional space.

Theoretical Findings

  1. Decoding Equivalence: They prove that using an ECOC instead of one-hot encoding is mathematically equivalent to changing the network's decoding metric from standard Euclidean ($l_2$) distance to Mahalanobis distance, which accounts for the correlations between codewords.
  2. The Robustness Threshold: They establish a "safety zone." If the distance between a "clean" network output and its nearest codeword is smaller than a specific threshold (determined by the code's normalized distance, the DNN architecture, and the noise scale), the network will predict correctly even in the presence of weight errors.
A geometric illustration of the robustness threshold. The perturbed output stays within a safe radius around the clean output, allowing for correct decoding if codewords are sufficiently distant.

Code Construction

Based on these insights, they propose two methods to build better codes:

  • Method 1 (Direct Optimization): For small tasks (few classes), they use gradient descent to optimize a codebook that balances orthogonality (for high accuracy on clean data) and pairwise distance (for robustness).
  • Method 2 (Picking from Hadamard): For complex tasks (many classes), they start with Hadamard codes—which are perfectly orthogonal—and strategically add "complementary" codes to increase the minimum distance between labels.
Comparison of Hadamard codes and the proposed Method 2 across geometric structure, correlation, and distance matrices. Method 2 strategically alters the structure to improve pairwise distance for robustness.

Datasets

The authors validated their approach across four standard benchmarks using various architectures (MLP, AlexNet, VGG16, and ResNet-50):

  • Small Scale: MNIST and CIFAR-10.
  • Large Scale: CIFAR-100 and Tiny ImageNet.

Key Insights and Ideas

  • The Orthogonality-Distance Trade-off: The paper reveals a fundamental tension. To perform well on "clean" (no-error) data, codewords should be orthogonal (uncorrelated). However, to survive weight errors, they need a large normalized distance (distance divided by the square root of the code length).
  • Normalized Distance is King: Traditional Hamming distance isn't enough; the theory shows that the distance must be scaled by the code length to provide a true robustness guarantee in the NTK regime.
  • Architecture Matters: The robustness threshold isn't just a property of the code; it's explicitly linked to the DNN's depth and activation functions, which dictate how errors propagate through the layers.

Key Results

The proposed codes consistently outperformed one-hot, repetition, random, and standard Hadamard codes.

  • Massive Robustness Gains: On CIFAR-100 with high weight noise ($\omega = 0.013$), standard one-hot encoding collapsed to 1.00% accuracy (random guessing), while the proposed Method 2 maintained 36.13% accuracy.
  • Superiority over Existing ECOCs: Their constructed codes surpassed existing state-of-the-art ECOC methods by up to 7% in accuracy across various noise levels.
  • Task-Specific Success: Method 1 proved superior for simple tasks like CIFAR-10, while Method 2 was more effective for large-scale tasks like Tiny ImageNet where optimization becomes difficult.

Limitations and Future Work

  • The NTK Assumption: The theory relies on the "infinite-width" assumption of NTK. While this provides a powerful analytical tool, real-world "narrow" networks might deviate from these theoretical predictions.
  • Simulation vs. Hardware: All results were obtained through software simulations of weight noise. The authors acknowledge that testing on actual physical NVCiM hardware is a necessary next step.
  • Decoding Complexity: While ECOCs improve robustness, they can increase the computational overhead of the final decoding layer, a factor that needs to be optimized for edge deployment.

Summary updated

BibTeX
@inproceedings{yu2024error,
  author = {Anlan Yu and Shusen Jing and Ning Lyu and Wujie Wen and Zhiyuan Yan},
  title = {{Error Correction Output Codes for Robust Neural Networks against Weight-errors: A Neural Tangent Kernel Point of View}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=7LIm53Jiic},
}
Figure