In-memory search with learning to hash based on resistive memory for recommendation acceleration

Fei Wang, Woyu Zhang, Zhi Li, Ning Lin, Rui Bao, Xiaoxin Xu, Chunmeng Dou, Zhongrui Wang, Dashan ShangNpj 2024

Abstract

Similarity search is essential in current artificial intelligence applications and widely utilized in various fields, such as recommender systems. However, the exponential growth of data poses significant challenges in search time and energy consumption on traditional digital hardware. Here, we propose a software-hardware co-optimization to address these challenges. On the software side, we employ a learning-to-hash method for vector encoding and achieve an approximate nearest neighbor search by calculating Hamming distance, thereby reducing computational complexity. On the hardware side, we leverage the resistance random-access memory crossbar array to implement the hash encoding process and the content-addressable memory with an in-memory computing paradigm to lower the energy consumption during searches. Simulations on the MovieLens dataset demonstrate that the implementation achieves comparable accuracy to software and reduces energy consumption by 30-fold compared to traditional digital systems. These results provide insight into the development of energy-efficient in-memory search systems for edge computing.

Introduction

Modern AI applications, particularly recommender systems used by platforms like Netflix or Amazon, rely on similarity searches to find "nearest neighbors" to a user's preferences within massive databases. As datasets grow exponentially, traditional computing architectures face two major bottlenecks: the high computational complexity of exact distance metrics (like Euclidean distance) and the von Neumann bottleneck, where energy-intensive data transfers between processor and memory limit performance. This paper presents a co-optimized approach to overcome these limitations using Learning-to-Hash (LTH) algorithms and Resistive RAM (RRAM) hardware.

Methods and Hardware Implementation

The proposed solution addresses efficiency through both software and hardware innovations.

Software: Learning-to-Hash

Instead of performing exact searches using floating-point math, the system employs a Learning-to-Hash method. A neural network maps high-dimensional query vectors into compact binary codes. This allows the search to be conducted using Hamming distance (counting bit differences), which is significantly faster and less complex than Euclidean distance calculations.

Comparison between Exact Nearest Neighbor Search using Euclidean distance and Approximate Nearest Neighbor Search using Hash Coding and Hamming distance.

Hardware: In-Memory Computing with RRAM

The hash encoding and search processes are implemented directly on RRAM crossbar arrays. RRAM serves as an in-memory computing platform, performing Multiply-Accumulate (MAC) operations for hash generation and functioning as Content-Addressable Memory (CAM) for parallel Hamming distance searches. By processing data where it is stored, the system bypasses the data transfer tax of conventional hardware.

Cross-sectional TEM image of the RRAM device stack, highlighting the TiN and Ta/TaOx layers used for resistive switching.

Key Results and Insights

The system was validated using the MovieLens 1M dataset and measurements from a 40nm 256kb RRAM chip.

  • Energy Efficiency: The RRAM-based LTH system achieved a 30-fold reduction in energy consumption compared to LTH on traditional digital hardware, and a 133-fold reduction compared to exact Euclidean searches.
  • Robustness to Hardware Noise: While RRAM devices exhibit inherent variation, the researchers found that recommendation tasks are naturally resilient to this noise. Minor shifts in item ranking do not significantly degrade the user experience in recommendation contexts.
  • Optimal Encoding: The study identified a 32-bit hash code as the ideal balance between accuracy and hardware robustness, preventing signal overlap caused by device noise.

Conclusion

By moving similarity searches into memory and simplifying the mathematical operations through hash coding, this approach offers a path toward highly energy-efficient recommender systems. While current implementations are proof-of-concept, future work focusing on high-density RRAM architectures could enable industrial-scale deployment, particularly for edge computing devices where power constraints are critical.

Summary updated

BibTeX
@inproceedings{wang2024memory,
  author = {Fei Wang and Woyu Zhang and Zhi Li and Ning Lin and Rui Bao and Xiaoxin Xu and Chunmeng Dou and Zhongrui Wang and Dashan Shang},
  title = {{In-memory search with learning to hash based on resistive memory for recommendation acceleration}},
  booktitle = {Npj},
  year = {2024},
  doi = {10.1038/s44335-024-00009-x},
}
Figure