In this paper, we propose shot optimization method for QML models at the expense of minimal impact on model performance. We use classification task as a test case for MNIST and FMNIST datasets using a hybrid quantum-classical QML model. First, we sweep the number of shots for short and full versions of the dataset. We observe that training the full version provides 5-6% higher testing accuracy than short version of dataset with up to 10X higher number of shots for training. Therefore, one can reduce the dataset size to accelerate the training time. Next, we propose adaptive shot allocation on short version dataset to optimize the number of shots over training epochs and evaluate the impact on classification accuracy. We use a (a) linear function where the number of shots reduce linearly with epochs, and (b) step function where the number of shots reduce in step with epochs. We note around 0.01 increase in loss and around 4% (1%) reduction in testing accuracy for reduction in shots by up to 100X (10X) for linear (step) shot function compared to conventional constant shot function for MNIST dataset, and 0.05 increase in loss and around 5-7% (5-7%) reduction in testing accuracy with similar reduction in shots using linear (step) shot function on FMNIST dataset. For comparison, we also use the proposed shot optimization methods to perform ground state energy estimation of different molecules and observe that step function gives the best and most stable ground state energy prediction at 1000X less number of shots.
翻译:本文提出了一种在量子机器学习模型中优化射击次数的方法,以最小程度影响模型性能。我们以分类任务为测试案例,使用混合量子-经典QML模型,在MNIST和FMNIST数据集上进行实验。首先,我们对数据集进行完整版和精简版的射击次数扫描,观察到完整版训练相比精简版可获得5-6%的测试准确率提升,但其训练射击次数最高可达精简版的10倍。因此,可通过减少数据集规模来加速训练过程。其次,我们提出在精简数据集上采用自适应射击分配策略,以优化训练轮次中的射击次数,并评估其对分类准确率的影响。我们采用两种函数:(a)线性函数,射击次数随轮次线性递减;(b)阶梯函数,射击次数随轮次呈阶梯式递减。与MNIST数据集传统恒定射击函数相比,线性(阶梯)射击函数在射击次数减少100倍(10倍)时,损失增加约0.01,测试准确率下降约4%(1%);在FMNIST数据集上,相同射击减少幅度下,线性(阶梯)射击函数导致损失增加0.05,测试准确率下降5-7%(5-7%)。作为对比,我们将提出的射击优化方法应用于不同分子的基态能量估计,观察到阶梯函数在射击次数减少1000倍时,仍能给出最优且最稳定的基态能量预测结果。