PECAN: A Product-Quantized Content Addressable Memory Network

Jie Ran, Rui Lin, Jason Chun Lok Li, Jiajun Zhou, Ngai Wong

TL;DR

PECAN (Product-QuantizEd Content Addressable Memory Network) is a novel deep learning architecture that replaces traditional, power-hungry multiplications with simple table lookups. By leveraging Product Quantization and Content Addressable Memory (CAM), the researchers created a "multiplier-free" variant that maintains high accuracy while being perfectly suited for the next generation of in-memory computing hardware.

What Problem Does This Paper Address?

Standard Deep Neural Networks (DNNs) are computationally expensive. The "bread and butter" of a DNN is the Multiply-Accumulate (MAC) operation. While modern GPUs handle billions of MACs easily, edge devices—like smartwatches, IoT sensors, or embedded chips—struggle with the energy and memory overhead.

Previous attempts to slim down networks (like Binary Neural Networks or AdderNets) still largely follow traditional architectures. This paper addresses the "memory wall" by rethinking the fundamental filtering operation. Instead of calculating a result every time, why not store common patterns and just look up the answer?

Methods

The core idea is to replace standard convolution and matrix multiplication with Product Quantization (PQ).

  1. The Lookup Strategy: The network breaks down input features into sub-vectors. Instead of multiplying these by weights, it finds the "closest match" from a pre-trained set of patterns called prototypes (stored in a codebook).
  2. Two Flavors of PECAN:
    • PECAN-A (Angle-Based): Uses dot-product similarity (like the attention mechanism in Transformers). It is highly accurate but still requires some multiplications.
  3. PECAN-D (Distance-Based): Uses $l_1$-distance (Manhattan distance), which only requires subtraction. This version is completely multiplier-free during inference.
  4. End-to-End Training: Finding the best prototypes is usually a heuristic process. The authors developed a way to make the "search and lookup" process differentiable using a softmax-based approximation. This allows the network to learn the best codebooks and weights simultaneously from scratch.
  5. Hardware Synergy: Because the operation is essentially a search, it maps perfectly onto Content Addressable Memory (CAM) and emerging technologies like Resistive RAM (RRAM), where "computing" happens directly where the data is stored.

Datasets

The authors evaluated PECAN across several standard computer vision benchmarks:

  • MNIST: Simple handwritten digit recognition.
  • CIFAR-10 & CIFAR-100: Small-scale natural image classification.
  • TinyImageNet: A more challenging, larger-scale dataset used to test the limits of the architecture.

Key Insights and Ideas

  • Memory as Compute: PECAN shifts the burden from the logic unit (ALU) to the memory. In a PECAN-D network, the "math" is literally just finding an index in a table.
  • The "Attention" Connection: PECAN-A essentially treats every layer like a simplified attention module, where the "keys" are the learned prototypes.
  • Sparsity and Pruning: The authors discovered that many prototypes in the codebook are rarely used. In one ResNet20 example, only 26 out of 64 prototypes were actually needed for inference, suggesting that these networks can be compressed even further by pruning the lookup tables.
  • Overcoming Non-Differentiability: The use of a "stop-gradient" trick and an epoch-aware tanh approximation for the sign function allowed them to train a discrete lookup system using standard backpropagation.

Key Results

  • Competitive Accuracy: On CIFAR-10, PECAN-A (91.82%) actually outperformed the baseline VGG-Small model (91.21%). PECAN-D achieved 90.19% while being entirely multiplier-free.
  • Massive Efficiency Gains: For a VGG-Small model, PECAN-D reduced the number of additions by nearly 40% compared to the baseline and eliminated 100% of floating-point multiplications.
  • Latency and Power: Compared to AdderNet (a popular multiplier-free competitor), PECAN-D showed significantly lower latency and power consumption (roughly 1/3rd the normalized power).
  • TinyImageNet Success: Even on larger datasets, PECAN-A achieved 59.42% accuracy, surpassing the baseline (56.76%) while using fewer operations.

Limitations and Future Work

  • Depth Sensitivity: The accuracy gap between PECAN and traditional baselines tends to widen as the networks get deeper (e.g., ResNet32 vs. LeNet).
  • Memory Footprint: While PECAN saves on computation, it requires storing codebooks. For very large models, managing these lookup tables could become a bottleneck.
  • Hardware Realization: While the paper demonstrates the algorithmic feasibility, the true benefits will only be realized when these networks are deployed on specialized CAM or RRAM hardware, which is still maturing in the industry.

The authors suggest that future work will focus on further pruning these codebooks and exploring even more efficient ways to map these "search-and-lookup" operations to physical hardware.

Summary updated

BibTeX
@inproceedings{ran2023pecan,
  author = {Jie Ran and Rui Lin and Jason Chun Lok Li and Jiajun Zhou and Ngai Wong},
  title = {{PECAN: A Product-Quantized Content Addressable Memory Network}},
  booktitle = {DATE},
  year = {2023},
  doi = {10.23919/date56975.2023.10137218},
}
Figure