journal article·2024-12-01Open access

InMemQK: A Product Quantization Based MatMul Module for Compute-in-Memory Attention Macro

Pengcheng Feng, Yihao Chen, Jinke Yu, Hao Yue, Zhelong Jiang, Yi Xiao, Wan’ang Xiao, Huaxiang Lu, Gang Chen

Applied Sciences· Volume 14· Issue 23

Abstract

Large Language Models (LLMs), based on transformer architecture, have demonstrated remarkable capabilities in natural language processing tasks, enabling machines to generate human-like text and engage in meaningful dialogues. However, the exponential increase in model parameters has led to limitations in inference speed and energy efficiency. Compute-in-memory (CIM) technology offers a promising solution to accelerate AI inference by performing analog computations directly within memory, potentially reducing latency and power consumption. At the same time, CIM has been successfully applied to accelerate Convolutional Neural Networks (CNNs); however, the matrix–matrix multiplication (MatMul) operations inherent in the scaled dot-product attention of the transformer present unique challenges for direct CIM implementation. In this work, we propose InMemQK, a compute-in-memory-based attention accelerator that focuses on optimizing MatMul operations through software and hardware co-design. At the software level, InMemQK employs product quantization (PQ) to eliminate data dependencies. At the hardware level, InMemQK integrates energy-efficient time-domain MAC macros for ADC-free computations. Experimental results show InMemQK achieves 13.2×–13.9× lower power consumption than existing CIM-based accelerators.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Advanced Memory and Neural Computing · Ferroelectric and Negative Capacitance Devices · Advanced Neural Network Applications

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Institute of Semiconductors, Chinese Academy of Sciences, Beijing 100083, China

University of Chinese Academy of Sciences, Beijing 101408, China

Semiconductor Neural Network Intelligent and Computing Technology Beijing Key Laboratory, Beijing 100083, China

Funding

National Natural Science Foundation of China · CAS Strategic Leading Science and Technology Project

References (36)

Show source-provided references
1. A brief overview of ChatGPT: The history, status quo and potential future development10.1109/JAS.2023.123618 ↗
2. Ds-transunet: Dual swin transformer u-net for medical image segmentation
3. ResViT: Residual vision transformers for multimodal medical image synthesis10.1109/TMI.2022.3167808 ↗
4. Review of wireless charging systems for autonomous underwater vehicles10.1109/JOE.2019.2953015 ↗
5. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
6. Mehta, S., and Rastegari, M. (2021). Mobilevit: Light-weight, general-purpose, and mobile-friendly vision transformer. arXiv.
7. Hamdioui, S., Pouyan, P., Li, H., Wang, Y., Raychowdhur, A., and Yoon, I. (2017, January 27–30). Test and reliability of emerging non-volatile memories. Proceedings of the 2017 IEEE 26th Asian Test Symposium (ATS), Taipei, Taiwan.10.1109/ATS.2017.42 ↗
8. Technological exploration of RRAM crossbar array for matrix-vector multiplication10.1007/s11390-016-1608-8 ↗
9. Hu, J., Shen, L., and Sun, G. (2018, January 18–23). Squeeze-and-excitation networks. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA.10.1109/CVPR.2018.00745 ↗
10. Kombrink, S., Mikolov, T., Karafiát, M., and Burget, L. (2011, January 27–31). Recurrent neural network based language model. Proceedings of the 12th Annual Conference of the International Speech Communication Association INTERSPEECH 2011, Florence, Italy.10.21437/Interspeech.2011-720 ↗
11. Optimized content caching and user association for edge computing in densely deployed heterogeneous networks10.1109/TMC.2020.3033563 ↗
12. Challenges and trends of SRAM-based computing-in-memory for AI edge devices10.1109/TCSI.2021.3064189 ↗
13. DNN+ NeuroSim V2. 0: An end-to-end benchmarking framework for compute-in-memory accelerators for on-chip training10.1109/TCAD.2020.3043731 ↗
14. Vaswani, A. (2017, January 4–9). Attention is all you need. Proceedings of the 31st Conference on Advances in Neural Information Processing Systems, Long Beach, CA, USA.
15. Li, W., Xu, P., Zhao, Y., Li, H., Xie, Y., and Lin, Y. (June, January 30). Timely: Pushing data movements and interfaces in pim accelerators towards local and in time domain. Proceedings of the 2020 ACM/IEEE 47th Annual International Symposium on Computer Architecture (ISCA), Valencia, Spain.10.1109/ISCA45697.2020.00073 ↗
16. Yang, X., Yan, B., Li, H., and Chen, Y. (2020, January 2–5). ReTransformer: ReRAM-based processing-in-memory architecture for transformer acceleration. Proceedings of the 39th International Conference on Computer-Aided Design, Virtual.10.1145/3400302.3415640 ↗
17. Sheu, S.-S., Chang, M.-F., Lin, K.-F., Wu, C.-W., Chen, Y.-S., Chiu, P.-F., Kuo, C.-C., Yang, Y.-S., Chiang, P.-C., and Lin, W.-P. (2011, January 20–24). A 4 Mb embedded SLC resistive-RAM macro with 7.2 ns read-write random-access time and 160 ns MLC-access capability. Proceedings of the 2011 IEEE International Solid-State Circuits Conference, San Francisco, CA, USA.10.1109/ISSCC.2011.5746281 ↗
18. Prime: A novel processing-in-memory architecture for neural network computation in reram-based main memory10.1145/3007787.3001140 ↗
19. ISAAC: A convolutional neural network accelerator with in-situ analog arithmetic in crossbars10.1145/3007787.3001139 ↗
20. Realization of artificial neuron using MXene bi-directional threshold switching memristors10.1109/LED.2019.2936261 ↗
21. Time-domain computing in memory using spintronics for energy-efficient convolutional neural network10.1109/TCSI.2021.3055830 ↗
22. Memristive devices for time domain compute-in-memory10.1109/JXCDC.2022.3217098 ↗
23. Product quantization for nearest neighbor search
24. Energy-efficient time-domain vector-by-matrix multiplier for neurocomputing and beyond
25. Tang, X., Wang, Y., Cao, T., Zhang, L.L., Chen, Q., Cai, D., Liu, Y., and Yang, M. (2023, January 2–6). Lut-nn: Empower efficient neural network inference with centroid learning and table lookup. Proceedings of the 29th Annual International Conference on Mobile Computing and Networking, Madrid, Spain.10.1145/3570361.3613285 ↗
26. End to end learning and optimization on graphs
27. Towards understanding the condensation of neural networks at initial training
28. A survey of the usages of deep learning for natural language processing10.1109/TNNLS.2020.2979670 ↗
29. Devlin, J. (2018). Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv.
30. Lan, Z. (2019). Albert: A lite bert for self-supervised learning of language representations. arXiv.
31. Liu, Y. (2019). Roberta: A robustly optimized bert pretraining approach. arXiv.
32. Wang, A. (2018). GLUE: A multi-task benchmark and analysis platform for natural language understanding. arxiv.10.18653/v1/W18-5446 ↗
33. Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., and Funtowicz, M. (2020, January 16–20). Transformers: State-of-the-art natural language processing. Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, Virtual.10.18653/v1/2020.emnlp-demos.6 ↗
34. RDCIM: RISC-V Supported Full-Digital Computing-in-Memory Processor with High Energy Efficiency and Low Area Overhead10.1109/TCSI.2024.3350664 ↗
35. Hsu, H.-H., Wen, T.-H., Khwa, W.-S., Huang, W.-H., Ke, Z.-E., Chin, Y.-H., Wen, H.-J., Chang, Y.-C., Hsu, W.-T., and Lele, A.S. (2024). A 22 nm Floating-Point ReRAM Compute-in-Memory Macro Using Residue-Shared ADC for AI Edge Device. IEEE J.-Solid-State Circuits.10.1109/JSSC.2024.3470211 ↗
36. 8-b precision 8-Mb ReRAM compute-in-memory macro using direct-current-free time-domain readout scheme for AI edge devices10.1109/JSSC.2022.3200515 ↗