Representable Matrices: Enabling High Accuracy Analog Computation for Inference of DNNs using Memristors

Baogang Zhang, Necati Uysal, Deliang Fan, Rickard Ewetz

TL;DR

This paper introduces a novel mapping technique for analog neural network accelerators using memristors. By jointly optimizing memristor conductance values and a global scaling factor, they significantly reduce errors in matrix-vector multiplication, leading to a dramatic improvement in classification accuracy for deep neural networks on real-world datasets.

What Problem Does This Paper Address?

Deep neural networks (DNNs) are computationally intensive, making their deployment on edge devices challenging. Memristor crossbar arrays (MCAs) offer a promising solution for accelerating DNN inference due to their analog computation capabilities, enabling faster and more energy-efficient matrix-vector multiplications. However, a key hurdle is accurately mapping the weight matrices of DNNs onto these physical memristor arrays. Existing methods often rely on heuristics that don't guarantee high accuracy across all inputs, leading to significant performance degradation, especially for complex networks like Convolutional Neural Networks (CNNs). This paper tackles the problem of maximizing the computational accuracy of DNN inference on MCA-based hardware by developing a more robust matrix mapping technique.

Methods

The core of the proposed methodology lies in a five-step process:

  1. Ideal Device Conversion: Non-ideal memristors and access transistors are initially modeled as ideal components to simplify the analytical derivation of the realized matrix.
  2. Scaling Factor Optimization: A crucial innovation is the explicit optimization of a global scaling factor ($\alpha$). This factor balances the trade-off between "value range errors" (when matrix elements fall outside the representable range of the MCA) and "precision errors" (due to limited memristor states). The authors propose an iterative approach that adjusts $\alpha$ to minimize total errors.
  3. Conductance Value Specification: Given the optimized $\alpha$, memristor conductance values ($g$) are determined to minimize the difference between the target matrix ($W$) and the realized matrix ($W^*$), while also ensuring that the output for a calibration vector ($v_{cal}$) is close to zero. This leverages the non-negative nature of DNN neuron outputs.
  4. State Variable Determination: The ideal conductance values are then converted back into the actual state variables ($s$) of the non-ideal memristors using Newton's method.
  5. On-Chip Programming: Finally, the memristors are programmed to these determined state variables using established closed-loop techniques.

Datasets

  • MNIST: Used for evaluating the classification accuracy of a feed-forward network.
  • CIFAR-10: Used for evaluating the classification accuracy of a seven-layer CNN.

Key Insights and Ideas

  • The "Representable Matrix" Space: The paper highlights that an MCA can realize a "space of representable matrices," and the accuracy depends on how well the target matrix fits within this space. The scaling factor $\alpha$ is key to navigating this space.
  • Balancing Value Range and Precision Errors: A critical insight is that simply minimizing the difference between the target and realized matrix isn't enough. The scaling factor must be carefully chosen to balance errors arising from the limited range of memristor conductances and errors due to the finite precision of memristor states.
  • Joint Optimization is Key: Unlike prior work that fixed either the scaling factor or focused on individual memristor tuning, this paper emphasizes the importance of jointly optimizing the scaling factor and conductance values for optimal accuracy.
  • Calibration Vector for DNNs: Leveraging the non-negative nature of DNN outputs by using a calibration vector ($v_{cal}$) helps constrain the mapping and improve accuracy, especially for elements that are difficult to represent.

Key Results

  • Reduced Matrix-Vector Multiplication Errors: The proposed mapping technique results in 4X-9X smaller errors in matrix-vector multiplication compared to the state-of-the-art method [5].
  • Improved Classification Accuracy:
    • For a seven-layer CNN on CIFAR-10, the classification accuracy improved from 20.5% to 71.8%, which is close to the software accuracy of 75.2%.
  • For a feed-forward network on MNIST, accuracies of 98.3% were achieved, outperforming the previous method's 96.3%.
  • Robustness to Noise: The proposed method shows graceful degradation in classification accuracy even with moderate to severe random telegraph noise (RTN).
  • Efficiency: The mapping technique achieves these accuracy improvements with minimal overhead in terms of power and area, as it primarily involves parameter optimization.

Limitations and Future Work

  • Mapping Time: While the accuracy is significantly improved, the mapping time for large matrices can still be substantial (e.g., 0.93 hours for a 128x128 CIFAR-10 CNN). The authors state their future work will focus on reducing this run-time.
  • Heuristic for Error Distribution: The method for distributing errors to ensure $||(W – W^*) \cdot v_{cal}|| = 0$ is heuristic and might not be optimal in all cases.
  • Further Optimization: The paper suggests exploring more advanced optimization techniques and potentially hardware-aware mapping strategies to further enhance performance and reduce mapping time.

Summary updated

BibTeX
@inproceedings{zhang2020representable,
  author = {Baogang Zhang and Necati Uysal and Deliang Fan and Rickard Ewetz},
  title = {{Representable Matrices: Enabling High Accuracy Analog Computation for Inference of DNNs using Memristors}},
  booktitle = {ASP-DAC},
  year = {2020},
  doi = {10.1109/asp-dac47756.2020.9045101},
}
Figure