While real quantum devices have been increasingly used to conduct research focused on achieving quantum advantage or quantum utility in recent years, executing deep quantum circuits or performing quantum machine learning with large-scale data on current noisy intermediate-scale quantum devices remains challenging, making classical simulation essential for quantum machine learning research. However, such classical simulation often suffers from the cost of gradient calculations, requiring enormous memory or computational time. To address these problems, we propose a method to fuse multiple consecutive gates in each of the forward and backward paths to improve throughput by minimizing global memory accesses. As a result, we achieved approximately $20$ times throughput improvement for a Hardware-Efficient Ansatz with $12$ or more qubits, reaching over $30$ times improvement on a mid-range consumer GPU with limited memory bandwidth. By combining our proposed method with gradient checkpointing, we drastically reduced memory usage, making it possible to train a large-scale quantum machine learning model, a $20$-qubit, $1{,}000$-layer model with $60{,}000$ parameters, using $1{,}000$ samples in approximately $20$ minutes per epoch. This implies that we can train the model on large datasets, comprising tens of thousands of samples, like MNIST or CIFAR-10, within a realistic time frame (e.g., $20$ hours per epoch). Thus, our proposed method significantly accelerates such classical simulations, making a significant contribution to advancing research in quantum machine learning and variational quantum algorithms, such as verifying algorithms on large datasets or investigating learning theories of deep quantum circuits like barren plateaus.
翻译:尽管近年来真实量子设备越来越多地被用于研究旨在实现量子优势或量子实用性的工作,但在当前含噪中等规模量子设备上执行深量子电路或利用大规模数据进行量子机器学习仍然具有挑战性,这使得经典模拟成为量子机器学习研究中不可或缺的手段。然而,此类经典模拟常因梯度计算成本而面临巨大内存或计算时间的消耗。为解决这些问题,我们提出了一种方法,在前向和后向路径中分别融合多个连续的门,通过最小化全局内存访问来提高吞吐量。实验结果表明,对于具有12个或更多量子比特的硬件高效拟设,我们的方法实现了约20倍的吞吐量提升,在内存带宽有限的中端消费级GPU上甚至达到30倍以上。通过将所提方法与梯度检查点技术结合,我们大幅减少了内存使用,使得能够训练大规模量子机器学习模型——一个包含20个量子比特、1000层、60,000个参数、使用1000个样本的模型,每个训练周期仅需约20分钟。这意味着我们可以在合理的时间框架内(例如每个训练周期20小时)对包含数万个样本的大型数据集(如MNIST或CIFAR-10)进行模型训练。因此,我们的方法显著加速了此类经典模拟,为推进量子机器学习和变分量子算法的研究(例如在大型数据集上验证算法或探索深量子电路的学习理论如贫瘠高原问题)做出了重要贡献。