
Implementation of Trained Factorization Machine Recommendation System on
Quantum Annealer
Chen-Yu Liu,1, 2, ∗Hsin-Yu Wang,3, 4, †Pei-Yen Liao,4, ‡Ching-Jui Lai,5, §and Min-Hsiu Hsieh1, ¶
1Hon Hai (Foxconn) Research Institute, Taipei, Taiwan
2Graduate Institute of Applied Physics, National Taiwan University, Taipei, Taiwan
3Department of Finance, National Taiwan University, Taipei, Taiwan
4Department of Mathematics, National Taiwan University, Taipei, Taiwan
5Department of Mathematics, National Cheng Kung University, Tainan, Taiwan
(Dated: November 9, 2023)
Factorization Machine (FM) is the most commonly used model to build a recommendation sys-
tem since it can incorporate side information to improve performance. However, producing item
suggestions for a given user with a trained FM is time-consuming. To address this problem, we
propose a quadratic unconstrained binary optimization (QUBO) scheme to combine with FM and
apply quantum annealing (QA) computation. Compared to classical methods, this hybrid algorithm
provides a fast sub-optimal sampling of good user suggestions. We then demonstrate the aforemen-
tioned computational behavior on current noisy intermediate-scale quantum (NISQ) hardware by
experimenting with a real example on a D-Wave annealer.
I. INTRODUCTION
Recommendation systems are widely used to predict
the rating or preference of items for arbitrary users, such
as suggesting books or movies, and also for many other
business applications [1–4]. A common principle for con-
structing a recommendation system assumes that users
prefer similar things based on past behavior. Amongst
several approaches, the objective of Matrix Factorization
(MF) is to find the factor matrices of historical data [5,6].
Together with MF, other improvements such as SVD++
[7], pairwise interaction tensor factorization (PITF) [8],
factorizing personalized Markov chains (FPMC) [9] and
Monte Carlo on bipartite graphs [10] has also been com-
prehensively studied. These methods introduce special-
ized models to treat specific tasks but with the trade-off
of losing generality.
To fix this, the Factorization Machine (FM) [11] is pro-
posed as a more general supervised learning method, uni-
fying MF, SVD++, PITF, and FPMC. With the capa-
bility to input arbitrary real-valued feature vectors to the
model, including side information (e.g., gender and age),
FM can be used for regression, classification, and ranking
tasks. Moreover, it can be trained with linear complexity
and accurately estimate model parameters from a sparse
dataset, which makes FM highly competent for analyz-
ing large datasets. Thus, it is more natural and adequate
to utilize FM for real-world applications than the other
methods mentioned earlier.
In recent years, quantum computing has become one
of the most popular domains, which aims to benefit from
∗cyliuphys@gapp.nthu.edu.tw
†b07703009@ntu.edu.tw
‡b08705006@ntu.edu.tw
§cjlai72@mail.ncku.edu.tw
¶min-hsiu.hsieh@foxconn.com
the superposition nature of quantum states. Quantum
Machine Learning (QML) employs parameterized quan-
tum circuits as a neural network, which can then be
applied to different classes of machine learning, such
as Quantum Neural Network (QNN) [12–14], Quantum
Convolutional Neural Network (QCNN) [15–17], Quan-
tum Reinforcement Learning (QRL) [18–20], and Quan-
tum Generative Adversarial Neural Network (QGAN)
[21–25]. Besides the structural exploration, several works
[26–34] have also investigated the learnability and train-
ability of QNN. Although the data encoding to a Hilbert
space may give potential computational advantages, at
the current stage of the NISQ era, only low-dimensional
or small sample problems can be implemented on real-
world hardware. Thus it is hard to justify the advantage
experimentally, and this needs to be further studied [35].
The concept of a Quantum Recommendation Sys-
tem (QRS) has also been proposed [36], for which
the idea is to sample an approximation of the pref-
erence matrix by quantum singular value estimation
and quantum projection. In that framework, QRS
takes O(poly(k)polylog(mn)) running time with kthe
rank of the approximation and mn the matrix dimen-
sion, while classically reconstructing an approximation
of the preference matrix requires polynomial time mn.
However, a classical analog of QRS, called Quantum-
Inspired Recommendation System (QIRS), provides
O(poly(k)log(mn)) running time [37], which closes the
gap between the classical and quantum methods. Be-
sides gate-based quantum computing, it is possible to
apply quantum annealing for feature selection [38] and
use these features to train a classical ItemKNN content-
based model [39]. This hybrid QPU solver shows good
scalability for larger instances but may not have a signif-
icant advantage in the running time.
The performance of QRS or QIRS depends on a good
low-rank approximation to the preference matrix [36,37].
Moreover, since these algorithms do not incorporate side
information, they may not be competitive with FM. Thus
arXiv:2210.12953v2 [quant-ph] 8 Nov 2023