Quantum Algorithm for Sparse Online Learning with Truncated Gradient Descent

## Abstract

Abstract Logistic regression, the Support Vector Machine (SVM), and least squares are well-studied methods in the statistical and computer science community, with various practical applications. High-dimensional data arriving on a real-time basis makes the design of online learning algorithms that produce sparse solutions essential. The seminal work of Langford, Li, and Zhang (2009) developed a method to obtain sparsity via truncated gradient descent, showing a near-optimal online regret bound. Based on this method, we develop a quantum sparse online learning algorithm for logistic regression, the SVM, and least squares. Given efficient quantum access to the inputs, we show that a quadratic speedup in the time complexity with respect to the dimension of the problem is achievable, while maintaining a regret of O ⁢ ( 1 / T ) 𝑂 1 𝑇 O(1/\sqrt{T}) italic_O ( 1 / square-root start_ARG italic_T end_ARG ) , where T 𝑇 T italic_T is the number of iterations.

## 1 Introduction

The field of statistical modeling and machine learning is about developing robust methodologies to uncover patterns, make predictions, and derive insights from data. Three prominent techniques are logistic regression, support vector machines (SVMs), and least squares. Regression and data fitting make use of least squares [, , , , , , , ] to study the relationship between predictor variables and a response variable in a set of data. In particular, given $N$ data points and their labels $\{x^{(i)},y^{(i)}\}_{i=1}^{N}$ such that $x^{(i)}\in\mathbb{R}^{d}$ and $y^{(i)}\in\mathbb{R}$ for all $i\in[N]$(^5^55$[N]$ denotes the set $\{1,\cdots,N\}$.), and a model function $f:\mathbb{R}^{d}\rightarrow\mathbb{R}$, the goal is to find the optimal $w$ that minimizes the squared loss $\sum_{i=1}^{N}(f\left(x^{(i)},w\right)-y^{(i)})^{2}$.

Unlike linear regression which models continuous outcomes, logistic regression is adept at predicting the probability of a discrete outcome, for example success or failure, making it an essential tool for understanding and predicting categorical data [, , , , , ]. In short, logistic regression can be described as follows: given a set of $N$ data points and their labels $\{x^{(i)},y^{(i)}\}_{i=1}^{N}$ such that $x^{(i)}\in\mathbb{R}^{d}$ and $y^{(i)}\in\{-1,1\}$ for all $i\in[N]$, logistic regression aims to find a $w\in\mathbb{R}^{d}$ that minimizes the loss $\sum_{i=1}^{N}\ln(1+e^{-(w\cdot x^{(i)})\cdot y^{(i)}})$.

On the other hand, SVM is a widely used tool in machine learning and finds applications in the domain of chemistry, biology, finance [, , , ], due to its simplicity of use and robust performance. A support vector machine is an algorithm that classifies vectors in a feature space into one of two sets, given training data from the sets []. SVM works by constructing the optimal hyperplane that partitions the two sets, either in the original feature space or a higher-dimensional, or even infinite dimensional, kernel space. In the soft-margin setting of the SVM, given a set of $N$ data points and their labels $\{x^{(i)},y^{(i)}\}_{i=1}^{N}$ such that $x^{(i)}\in\mathbb{R}^{d}$ and $y^{(i)}\in\{-1,1\}$ for all $i\in[N]$, the goal is to find a $w\in\mathbb{R}^{d}$ that minimizes the hinge loss $\sum_{i=1}^{N}\max\{0,(1-y^{(i)}w\cdot x^{(i)})\}$.

#### The online learning framework.

Online learning algorithms have gained much attention in recent decades, in both the academic and industrial sectors [, , , , , , ]. In this framework, the learner (also known as the learning algorithm) who is given access to partial, sequential training data, is required to output a solution based on partial knowledge of the training data. The solution is then updated in the next iteration after receiving more training data as input. This process is repeated for $T$ number of iterations. More specifically, for every time $t=1,\cdots,T$, the following sequence of events take place:

- 1)
The learner receives an unlabelled example $x^{(t)}$;
- 2)
The learner makes a prediction $\hat{y}^{(t)}$ based on an existing weight vector $w^{(t)}\in\mathbb{R}^{d}$;
- 3)
The learner receives the true label $y^{(t)}$ and suffers a loss $L(w^{(t)},x^{(t)},y^{(t)})$ that is convex in $w^{(t)}$;
- 4)
The learner updates the weight vector according to some update rule $w^{(t+1)}\leftarrow f(w^{(t)})$.

Due to the fact that the input data of online algorithms can be adversarial in nature, such algorithms are particularly useful in proving guarantees for worst-case inputs. Besides having an efficient running time, the design of online algorithms focuses on regret minimization. The *regret* of an online algorithm is defined as the difference between the total loss incurred using a certain sequence of strategies and the total loss incurred using the best fixed strategy in hindsight []. Specifically,(^6^66Strictly speaking, this is the per-step regret as we normalize by $T$. While the conventional regret is the unnormalized version, we nevertheless call this the regret in this paper.)

$$ $\mathit{Regret}\coloneqq\frac{1}{T}\sum_{t=1}^{T}L\left(w^{(t)},x^{(t)},y^{(t) }\right)-\min_{u\in\mathbb{R}^{d}}\frac{1}{T}\sum_{t=1}^{T}L\left(u,x^{(t)},y^ {(t)}\right).$ $$

In the era of big data, we are often faced with large and high-dimensional problem data. As a result, the solution to the learning problem will inherit a large dimension. Techniques such as best subsets, forward selection, and backward elimination [, , , , , , , , , , , , ] enhance computational efficiency and ease the interpretability of the solution. Seeing the importance of sparse solutions and the strength of online algorithms, the need for sparse online learning is apparent [, , ].

The work of [] introduced a truncated gradient descent algorithm for sparse online learning. In their algorithm, the solution is updated via gradient descent at every iteration and a truncation is performed on the solution after every $K$ iterations, where $K$ needs to be carefully chosen (see Algorithm A in Appendix A). In their work, the following assumptions are made.

###### Assumption 1 ( [ LLZ09 ] ) .

For every $t\in[T]$,

- (i)
The loss function $L(w^{(t)},x^{(t)},y^{(t)})$ is convex in $w^{(t)}$ for all $x^{(t)},y^{(t)}$.
- (ii)
There exist constants $A,B\in\mathbb{R}_{>0}$ such that $\|\nabla_{w^{(t)}}L(w^{(t)},x^{(t)},y^{(t)})\|_{2}^{2}\leq A\cdot L(w^{(t)},x^
{(t)},y^{(t)})+B$ for all $x^{(t)},y^{(t)}$, where $\|\cdot\|_{2}$ denotes the Euclidean norm.
- (iii)
$\sup_{x^{(t)}}\lVert x^{(t)}\rVert_{2}\leq C$ for some constant $C\in\mathbb{R}_{+}$.

Under these assumptions, the authors of [] showed that their online algorithm achieves an $O(1/\sqrt{T})$ regret (refer to Fact 2 in Appendix C.2).
As also noted in [], the general loss function for linear prediction problems is of the form $L(w^{(t)},x^{(t)},y^{(t)})=h(w^{(t)T}x^{(t)},y^{(t)})$. They pointed out some common loss functions $h(\cdot,\cdot)$ with corresponding choices of parameters $A$ and $B$ (which are not necessarily unique), under the assumption that $\sup_{x^{(t)}}\lVert x^{(t)}\rVert_{2}\leq C$. Among them are

- •
Logistic regression: $h(w^{(t)T}x^{(t)},y^{(t)})=\ln(1+\exp(-w^{(t)T}x^{(t)}\cdot y{(t)}))$; $A=0$, $B=C^{2}$, $y^{(t)}\in\{\pm 1\}$ for all $t\in[T]$.
- •
SVM (hinge loss): $h(w^{(t)T}x^{(t)},y^{(t)})=\max\{0,1-w^{(t)T}x^{(t)}\cdot y{(t)}\}$; $A=0$, $B=C^{2}$, $y^{(t)}\in\{\pm 1\}$ for all $t\in[T]$.
- •
Least squares (square loss): $h(w^{(t)T}x^{(t)},y^{(t)})=(w^{(t)T}x^{(t)}-y^{(t)})^{2}$; $A=4C^{2}$, $B=0$, $y^{(t)}\in\mathbb{R}$ for all $t\in[T]$.

###### Assumption 1 ( [ LLZ09 ] ) .

#### Main contribution.

In this work, we present a quantum online algorithm that outputs a sparse solution, which has applications to logistic regression (Section 5.1), the SVM (Section 5.2) and least squares (Section 5.3). Our work is based on [], who introduced a truncated gradient descent algorithm for sparse online learning. The guarantees of our algorithm hold under the same assumptions as [] (to be discussed later). While maintaining the $O(1/\sqrt{T})$ regret bound of [], our quantum algorithm has time complexity of $\tilde{O}(T^{5/2}\sqrt{d})$,(^7^77$\tilde{O}(\cdot)$ suppresses polylogarithmic factors.) achieving a quadratic speedup in the dimension over the classical $O(Td)$, where $d$ is the dimension of a data point. This speedup is noticeable when $d\geq\tilde{\Omega}(T^{5})$, making the algorithm useful for high-dimensional learning tasks. We summarize our results in the Table 1.

**Table 1: Summary of results**
| Problem | Time Complexity | Regret |  |  |
| --- | --- | --- | --- | --- |
| [] | Our Work | [] | Our Work |  |
| Logistic regression | $O(Td)$ | $\tilde{O}(T^{5/2}\sqrt{d})$ | $O(1/\sqrt{T})$ | $O(1/\sqrt{T})$ |
| SVM | $O(Td)$ | $\tilde{O}(T^{5/2}\sqrt{d})$ | $O(1/\sqrt{T})$ | $O(1/\sqrt{T})$ |
| Least squares | $O(Td)$ | $\tilde{O}(T^{5/2}\sqrt{d})$ | $O(1/\sqrt{T})$ | $O(1/\sqrt{T})$ |

Our algorithm does not need to read in all the entries of the input data at once.
For a data point $x^{(t)}\in\mathbb{R}^{d}$, the $j$-th entry of $x^{(t)}$, $x^{(t)}_{j}$, can be accessed in $\tilde{O}(1)$ time on a classical computer.
We assume that $x^{(t)}_{j}$ can be accessed in $\tilde{O}(1)$ time coherently on a quantum computer (formally defined in Data Input 1), which is the standard quantum input model employed in the previous literature, e.g., [, , ].

Our quantum algorithm returns the weight vectors $w^{(1)},w^{(2)},\dots,w^{(T)}$ indirectly.
Specifically, for each $w^{(t)}$ with $1\leq t\leq T$, our algorithm enables us to coherently access each of its entries in $O(t)$ time.
Notably, the cost of accessing one entry of $w^{(t)}$ is upper bounded by $O(T)$, and $T$ is usually set to $O(1/\epsilon^{2})$ (which is independent of the dimension $d$) if we want a regret of $\epsilon$ in concrete applications such as logistic regression, SVM, and least squares in Table 1.
Especially for constant regret, e.g., $\epsilon=0.1$, the cost is a constant time.
In addition, this output model is even useful when we do not need to know the exact value of each entry of $w^{(t)}$ but certain expectations with respect to $w^{(t)}$.
As suggested in [], the (normalized) quantum state $\lvert w^{(t)}\rangle$ can be useful in estimating the expectations.
To this end, our quantum algorithm allows us to further prepare $\lvert w^{(t)}\rangle$ with an extra time complexity of $\tilde{O}(t\sqrt{d})$ through the standard quantum state preparation []; this is negligible compared to the overall time complexity $\tilde{O}(T^{5/2}\sqrt{d})$.

#### Techniques.

Our quantum algorithm is based on the framework of []. In this framework, the algorithm maintains a sparse weight vector by performing the truncation regularly. Our main observation is that in the framework, a large number of updates (linear in the data dimension $d$) are required (on a classical computer) while the prediction in each iteration is just a single real number.
This motivates us to find a reasonable trade-off between the update and the prediction, and we then realized how to achieve this on a quantum computer.

Our quantum speedup comes from the techniques that rely on quantum amplitude estimation and amplification [, , , ]. In particular, we use subroutines such as quantum inner product estimation, quantum norm estimation and quantum state preparation. This allows us to obtain a quadratic speedup in the dimension $d$ for the prediction.
For the update, we do not actually perform the updates but implement them in an oracle-oriented manner so that any entry of the intermediate vectors can be computed in $\tilde{O}(T)$ time, which is sufficient for us to make the prediction efficiently on a quantum computer.
Specifically, we leverage the circuits for efficient arithmetic operations to avoid storing the weight vector in every iteration, thereby saving the space and time of the algorithm.
Under this quantized framework, we develop quantum algorithms for logistic regression, the SVM and least squares by specifying the quantum circuits with appropriate parameters for the corresponding

#### Applications.

Let $u^{*}$ be the best fixed strategy in hindsight. For logistic regression and the SVM, we observe that by taking $T=\Theta(C^{4}\|u^{*}\|_{2}^{4}/\epsilon^{2})$, the regret of our quantum algorithm becomes $\Theta(\epsilon)$.
This setting implies quantum algorithms for (offline) logistic regression and SVM with time complexity $\tilde{O}(C^{10}\|u^{*}\|_{2}^{10}\sqrt{d}/\epsilon^{5})$, which achieves an exponential improvement in the dependence on $C\|u^{*}\|_{2}$ for logistic regression and a polynomial improvement in the $\epsilon$-dependence for the SVM, compared to the prior best offline results due to [, ] respectively. Moreover, taking $T=\Theta((C^{6}+C^{4}\|u^{*}\|_{2}^{4})/\epsilon^{2})$ results in a $\Theta(\epsilon)$ regret for least squares and a time complexity of $\tilde{O}(C^{15}\|u^{*}\|_{2}^{6}\sqrt{d}/\epsilon^{5})$, if the prediction error is constant-bounded. This setting implies a quantum algorithm for (offline) least squares. For reference, a quantum algorithm for offline least squares with different conditions was presented in [].(^8^88In these offline settings, the output is the “average” vector $\bar{w}=\frac{1}{T}\sum_{t=1}^{T}w^{(t)}$. For a fair comparison with the offline results, after the execution of our algorithm, it provides quantum access to each entry of $\bar{w}$ at an extra cost of $\tilde{O}(T^{2})$, where $T$ is usually chosen to be independent of the dimension $d$ in the presented applications.)

## 2 Related Work

Motivated by the importance of obtaining sparse solutions for the aforementioned reasons in the previous section,
various methods have been used to achieve sparsity in learning algorithms. Some examples include randomized rounding [], forward sequential selection [], backward sequential elimination [] and adaptive forward-backward greedy algorithm [].

In the online setting, a method called Forward-Backward Splitting (FOBOS) with an $\ell_{1}$-norm regularizer has been proposed by Duchi et al. []. This approach is analogous to the projected gradient descent, where the projection step is replaced with a minimization
problem. Inspired by dual-averaging techniques, the Regularized Dual Averaging (RDA) algorithm by Xiao et al. [] is designed for problems whose objective function consists of a convex loss function and a convex regularization term. Under certain conditions, it achieves $O(1/\sqrt{T})$ regret and proves effective for sparse online learning with $\ell_{1}$-regularization. The authors in [] gave two online feature selection algorithms, which are modifications of the Perceptron algorithm []. The performance of both algorithms is evaluated numerically and via the mistake bound. Other references on sparse online learning include [, , , , , ].

In the offline setting, quantum algorithms for least squares and SVM have been studied. The recent work by [] gave a quantum algorithm that outputs a solution such that the $\ell_{2}$-norm of the residual vector approximates that of the optimal solution up to a relative error of $\epsilon>0$ with high probability. Their algorithm runs in time $\tilde{O}(\sqrt{n}d^{1.5}/\epsilon+d^{\omega}/\epsilon)$, where $n$ is the sample complexity and $\omega\approx 2.37$ denotes the exponent of matrix multiplication. This improves upon the best classical algorithm which runs in time $O(nd)+\operatorname{poly}(d/\epsilon)$ []. Moreover, Liu and Zhang [] proposed a quantum algorithm that solves the same problem in time $O\left(\log(n+d)s^{2}\kappa^{3}/\epsilon^{2}\right)$, where $s$ denotes the sparsity of the data matrix and $\kappa$ is the condition number. Other quantum algorithms for linear regression [, , ] have been discussed. However, the time complexity of these algorithms depends on some quantum linear-algebra [] related parameters, such as the condition number of the data matrix [, , ]. For the SVM, the authors in [] showed a quantum algorithm based on HHL and quantum linear algebra techniques. For the case of general data sets, Li, Chakrabarti and Wu [] gave a quantum algorithm that runs in time $\tilde{O}\left(\frac{\sqrt{n}}{\epsilon^{4}}+\frac{\sqrt{d}}{\epsilon^{8}}\right)$, improving over the classical running time of $O\left(\frac{n+d}{\epsilon^{2}}\right)$ by []. The complexity of the quantum SVM has been studied by []. Several sublinear time quantum algorithms were developed under the framework of online learning, e.g., for semidefinite programming [, , , ], zero-sum games [, , , ], general matrix games [] and learning of quantum states [, , ].

With regards to how quantum computing can improve the efficiency of algorithms on feature selection, Saeedi and Arodz [] proposed the Quantum Sparse Support Vector Machine (QsSVM), an approach that minimizes the training-set objective function of the Sparse SVM model [, , , ] by using a quantum algorithm for solving linear programs (LPs) [] instead of a classical LP solvers. While quantum LP solvers may not speed up arbitrary binary classifiers, they offer sublinear time complexity in the number of samples and features for sparse linear models, unlike classical algorithms.
Sampling can be considered a form of feature selection. The quantum online portfolio optimization algorithm by [] employs quantum multi-sampling to invest in sampled assets. Their approach achieves quadratic speedup compared to classical methods [], with a marginal increase in regret. The authors of [] studied quantum-enhanced least-square SVM with two quantum algorithms. The first employs a simplified quantum approach using continuous variables for matrix inversion, while the second is a hybrid quantum-classical method providing sparse solutions with quantum-enhanced feature maps, both achieving exponential speedup in sample size. Other related quantum algorithms include [, , , , ].

## 3 Preliminaries

#### Notations.

For a positive integer $d\in\mathbb{Z}_{+}$, we use $[d]$ to represent the set $\{1,\cdots,d\}$. Given a vector $u\in\mathbb{R}^{d}$, we denote the $j$-th entry of $u$ as $u_{j}$ for all $j\in[d]$ and denote the $\ell_{1}$-norm and $\ell_{\infty}$ norm of $u$ as $\lVert u\rVert_{1}:=\allowdisplaybreaks\sum_{j=1}^{d}|u_{j}|$ and $\lVert u\rVert_{\infty}:=\max_{j\in[d]}|u_{j}|$. If the vector has a time dependency, we denote it as $u^{(t)}$. For some condition $C$, we use $I(C)$ to denote the indicator function that evaluates to 1 if $C$ is satisfied and 0 otherwise. We use $\bar{0}$ to denote the all zeros vector and use $\lvert\bar{0}\rangle$ to denote the state $\lvert 0\rangle\otimes\cdots\otimes\lvert 0\rangle$ where the number of qubits is clear from the context. We use $\tilde{O}(\cdot)$ to hide polylog factors, i.e. $\tilde{O}(f(n,m))=O(f(n,m)\cdot\operatorname{polylog}(n,m))$.

#### Quantum computational model.

A quantum algorithm is described by a quantum circuit with queries to the input oracle.
We define the query complexity of a quantum algorithm as the number of queries to the input oracle.
The time complexity of a quantum algorithm is the sum of its query complexity and the number of elementary quantum gates in it. We assume a quantum arithmetic model, which allows us to ignore issues arising from the fixed-point representation of real numbers. In this model, each elementary arithmetic operation takes a constant time. Our quantum algorithm assumes quantum query access to the input oracle for certain vectors.
For a vector $u\in\mathbb{R}^{d}$, the input oracle for $u$ is a unitary operator $O_{u}$ such that $O_{u}\lvert j\rangle\lvert\bar{0}\rangle=\lvert j\rangle\lvert u_{j}\rangle$ for every $j\in[d]$, where the second register is assumed to contain sufficiently many qubits to ensure that all subsequent computations are accurate, in analogy to the sufficient bits that a classical algorithm assumes to run correctly.

#### Truncated gradient descent.

One of the most popular approaches for minimizing a convex loss function $L$ is gradient descent. Starting from an initial point $w^{(1)}$, gradient descent performs

$$ $w^{(t+1)}=w^{(t)}+\eta^{(t)}\nabla L(w^{(t)})$ $$

for $t=1,2,3,\cdots$, where $\eta^{(t)}>0$ is the step size/learning rate at iteration $t$ and $\nabla L(w^{(t)})$ is the gradient of $L$ at $w^{(t)}$. The algorithm is summarized in Algorithm 2 (refer to Appendix A). Seeing the need for sparse solutions in the high-dimensional regime, the authors of [] introduced a truncated gradient descent update rule that truncates each entry $j\in[d]$ of the weight vector after certain number of iterations according to the following function: for some threshold $\theta>0$ and a *gravity* parameter(^9^99The gravity parameter measures the amount of shrinkage.) $\alpha>0$,

$$ $\displaystyle\mathcal{T}(w_{j}^{(t)},\alpha,\theta)=\begin{cases}\max\{w_{j}^{ (t)}-\alpha,0\},\text{ if }0\leq w^{(t)}_{j}\leq\theta\\ \min\{w_{j}^{(t)}+\alpha,0\},\text{ if }-\theta\leq w^{(t)}_{j}\leq 0\\ w^{(t)}_{j},\text{ otherwise.}\\ \end{cases}$ (1) $$

The truncated gradient descent method is summarized in Algorithm A (refer to Appendix A).

While adaptive learning rates could potentially speed up the convergence of gradient descent [, , ], we adopt a constant learning rate with fixed $\eta>0$ as in the setting of [] for simplicity. Moreover, while the choice of gravity parameters is usually kept open in practice, we shall only consider the following choice: for all $t\in[T]$,
$\alpha^{(t)}=g^{(t)}\eta$ such that $g^{(1)}=\cdots=g^{(T)}\leq g_{\max}$, where $g_{\max}$ is some constant.

## 4 Quantum Algorithm

In this section, we present our quantum algorithm for sparse online learning, which has applications to logistic regression, the SVM and least squares. We clarify the data input and output model, as well as quantum subroutines in the next subsections.

### 4.1 Quantum input and output model

We assume quantum query access via an oracle for the entries of unlabelled examples. The online nature of the problem is given by the fact that we obtain these oracles at different times.

###### Data Input 1 (Online example oracles) .

Let $x^{(1)},\cdots,x^{(T)}\in\mathbb{R}^{d}$ be unlabelled examples. Define the unitaries $U_{x^{(t)}}$ operating on $O(\log d)$ qubits such that for all $j\in[d]$ and $t\in[T]$, $U_{x^{(t)}}\lvert j\rangle\lvert\bar{0}\rangle\rightarrow\lvert j\rangle\lvert
x
^{(t)}_{j}\rangle$. At time $t\in[T]$, assume access to $U_{x^{(1)}},\cdots,U_{x^{(t)}}$.

As for the output of our quantum algorithm, it returns weight vectors $w^{(1)},w^{(2)},\dots,w^{(T)}$ indirectly. In particular, for all $t\in[T]$, we are allowed coherent access to the entries of $w^{(t)}$ in $O(t)$ time. This cost is upper bounded by $O(T)$. In addition, this output model allows us to further prepare $\lvert w^{(t)}\rangle$, through the standard quantum state preparation [], as suggested in [], such a (normalized) quantum state $\lvert w^{(t)}\rangle$ can be useful in estimating expectations.

###### Data Input 1 (Online example oracles) .

### 4.2 Quantum subroutines

By approximating real numbers to sufficient accuracy, the truncation function Eq. (1) can be efficiently computed by assuming access to *minmax* and *between* oracles. Similar oracles have been studied in  [, , , ].

###### Lemma 4.1 (Minmax and Between oracles [ LMNS24 ] ) .

Let $a,b,x\in\{0,1\}^{n}$ and $c,z\in\{0,1\}$.

- (i)
We say that we have access to a comparison oracle $\mathcal{O}_{comp}$ if we have access to a unitary $U_{comp}$ that performs the operation
$U_{comp}:\lvert x\rangle\lvert a\rangle\lvert z\rangle\mapsto\lvert x\rangle
\lvert a\rangle\lvert z\oplus\mathbbm{1}_{x<a}\rangle$
using $s_{comp}$ Toffoli(^10^1010A Toffoli gate as a T-count of 7 and a T-depth of 3.) gates.
- (ii)
We say that we have access to a controlled-comparison oracle $\mathcal{O}^{\prime}_{comp}$ if we have access to a unitary $U^{\prime}_{comp}$ that performs the operation $U^{\prime}_{comp}:\lvert c\rangle\lvert x\rangle\lvert a\rangle\lvert z\rangle
\mapsto\lvert c\rangle\lvert x\rangle\lvert a\rangle\lvert z\oplus c\cdot
\mathbbm{1}_{x<a}\rangle$
using $s^{\prime}_{comp}$ Toffoli gates.
- (iii)
Assuming access to a comparison oracle and a controlled-comparison oracle, there exists a circuit that performs the operation $U_{Btw}:\lvert a\rangle\lvert b\rangle\lvert x\rangle\lvert z\rangle\mapsto
\lvert a\rangle\lvert b\rangle\lvert x\rangle\lvert z\oplus\mathbbm{1}_{x\in[a
,b]}\rangle$
using $1.5s_{comp}+s^{\prime}_{comp}$ Toffoli gates. We call this the Between oracle.

The values of $s_{comp}$ and $s^{\prime}_{comp}$ depend on the type of circuit architecture used for the comparators [, ]. Nevertheless, these are in general $O(n)$.
We say that we have access to a minmax oracle if we have access to a unitary $U_{\text{minmax}}$ that performs the following operation

$$ $\displaystyle U_{\text{Minmax}}\lvert c\rangle\lvert x\rangle\lvert 0\rangle= \begin{cases}\lvert c\rangle\lvert x\rangle\lvert\max(x,0)\rangle,\text{ if }c =1\\ \lvert c\rangle\lvert x\rangle\lvert\min(x,0)\rangle,\text{ if }c=0.\end{cases}$ $$

using $O(n)$ number of Toffoli gates.

Using the oracles defined above, we show the following lemma, whose proof can be found in Appendix B.1.

###### Lemma 4.2 (Truncation unitary) .

Let $\theta,\alpha\in\mathbb{R}_{>0}$. Assuming access to a Between oracle and a Minmax oracle, there exists a unitary operator $U_{\mathcal{T},\alpha,\theta}$ that does the following operation up to sufficient accuracy in constant time: $U_{\mathcal{T},\alpha,\theta}\colon\lvert x\rangle\lvert 0\rangle\mapsto\lvert
x
\rangle\lvert f(x)\rangle$,
where

$$ $f(x)=\begin{cases}\max\{x-\alpha,0\},&0<x\leq\theta,\\ \min\{x+\alpha,0\},&-\theta\leq x<0,\\ x,&\textit{otherwise}.\end{cases}$ $$

Unbiased amplitude estimation [, , ] allows one to obtain nearly unbiased estimates with low variance and without destroying their initial quantum state.

###### Fact 1 (Unbiased amplitude estimation [ CH23 , Theorem 2.4] ) .

Let $t\geq 4$ and $\epsilon\in(0,1)$. We are given one copy of a quantum state $\lvert\psi\rangle$ as input, as well as a unitary transformation $U=2\lvert\psi\rangle\langle\psi\rvert-I$, and a unitary transformation $V=I-2P$ for some projector $P$. There exists a quantum algorithm that outputs $\tilde{a}$, an estimate of $a=\|P\lvert\psi\rangle\|^{2}$, such that

$$ $|\mathbb{E}[\tilde{a}]-a|\leq\epsilon\text{ and }\operatorname{Var}[\tilde{a}] \leq\frac{91a}{t^{2}}+\epsilon$ $$

using $\mathcal{O}(t\log\log(t)\log(t/\epsilon))$ applications of $U$ and $V$ each. The algorithm restores the quantum state $\lvert\psi\rangle$ at the end of the computation with probability at least $1-\epsilon$.

Quantum state preparation, norm and inner production are widely used subroutines [, , , , ] that rely on amplitude estimation []. We restate these subroutines for the convenience of the reader. The proof is based on Fact 1, which is deferred to Appendix B.2. We also note that an additive variant of Lemma 4.3(i) can be easily derived with the same time complexity and resources.

###### Lemma 4.3 (Quantum norm estimation and state preparation [ vAG19a , BHMT02 , HRRS19 , LCW19 , RHR + 21 ] ) .

Let $u\in\mathbb{R}^{d}$ and assume quantum access to $u\in\mathbb{R}^{d}$. Then,

- (i)
Let $\delta\in(0,1/4)$ and $\epsilon_{0}\in(0,1)$.
There exists a quantum algorithm that outputs an estimate $\tilde{\Gamma}$ of $\lVert u\rVert_{1}$ such that $\lvert\tilde{\Gamma}-\lVert u\rVert_{1}|\leq\epsilon_{0}\left\|u\right\|_{1}$ with probability at least $1-4\delta$. The algorithm runs in time $\tilde{O}\left(\frac{\sqrt{d}}{\delta}\right)$.
- (ii)
Let $\zeta\in(0,1/2]$ and $\tilde{\Gamma}>0$ be given such that $|\lVert u\rVert_{1}-\tilde{\Gamma}|\leq\zeta\lVert u\rVert_{1}$. Let $\delta\in(0,1)$. An approximation $|\tilde{p}\rangle=\sum_{j=1}^{d}\sqrt{|p_{j}|}\lvert j\rangle$ of the state $|u\rangle=\sum_{j=1}^{d}\sqrt{\frac{|u_{j}|}{\lVert u\rVert_{1}}}\lvert j\rangle$ can be prepared with probability $1-\delta$ in $O\left(\sqrt{d}\log\frac{1}{\delta}\right)$ time and $\tilde{O}\left(\sqrt{d}\log\frac{1}{\zeta}\log\frac{1}{\delta}\right)$ gates. The approximation in $\ell_{1}$-norm of the probabilities is $\lVert\tilde{p}-\frac{u}{\lVert u\rVert_{1}}\rVert_{1}\leq 2\zeta$

The following lemma explains a quantum inner product estimation algorithm which uses amplitude estimation to approximate the inner product between two real vectors. We defer the proof to Appendix B.3.

###### Lemma 4.4 (Quantum inner product estimation [ YGSR23 ] ) .

Let $\epsilon,\delta\in(0,1)$ and given access to nonzero vectors $u,v\in\mathbb{R}^{d}$. An estimate $\widetilde{IP}$ of the inner product $u\cdot v$ can be obtained such that $|\widetilde{IP}-u\cdot v|\leq\epsilon$ with success probability at least $1-\delta$. This requires $O\left(\frac{\lVert u\rVert_{\infty}\lVert v\rVert_{1}\sqrt{d}}{\epsilon}\log
\frac{1}{\delta}\right)$ queries and $\tilde{O}\left(\frac{\lVert u\rVert_{\infty}\lVert v\rVert_{1}\sqrt{d}}{
\epsilon}\log\frac{1}{\delta}\right)$ quantum gates.

###### Lemma 4.1 (Minmax and Between oracles [ LMNS24 ] ) .

###### Lemma 4.2 (Truncation unitary) .

###### Fact 1 (Unbiased amplitude estimation [ CH23 , Theorem 2.4] ) .

###### Lemma 4.3 (Quantum norm estimation and state preparation [ vAG19a , BHMT02 , HRRS19 , LCW19 , RHR + 21 ] ) .

###### Lemma 4.4 (Quantum inner product estimation [ YGSR23 ] ) .

### 4.3 Quantum algorithm for sparse online learning

Given Data Input 1, the following computation can be performed in superposition on indices $j\in[d]$, which allows us to efficiently compute each entry of the weight vector $w^{(t)}$ at any time step $t$. We defer the proof to Appendix B.4. Similar unitaries were studied in, e.g.,  [, , , ].

###### Lemma 4.5 .

Let $\theta\in\mathbb{R}_{>0}$. For all $t\in[T]$, given example oracles $U_{x^{(t)}}$ as in Data Input 1, vectors $y=(y^{(1)},\cdots,y^{(t)}),\tilde{y}=(\tilde{y}^{(1)},\cdots,\tilde{y}^{(t)})
\in\mathbb{R}^{t}$ and a real number $\eta\in\mathbb{R}_{>0}$. Assuming access to a gravity sequence $(g^{(1)},\cdots,g^{(T)})$ and a truncation oracle as in Lemma 4.2, there exists a unitary operators that perform the operation $\lvert j\rangle\lvert\bar{0}\rangle\rightarrow\lvert j\rangle\lvert w^{(t)}_{j}\rangle$ to sufficient numerical precision, where

- (i)
For logistic regression, $w^{(t)}_{j}=\mathcal{T}\left(w_{j}^{(t-1)}+2\eta\frac{x_{j}^{(t)}y^{(t)}e^{-y^
{(t)}\tilde{y}^{(t)}}}{1+e^{-y^{(t)}\tilde{y}^{(t)}}},g^{(t)}\eta,\theta\right)$;
- (ii)
For the SVM, $w^{(t)}_{j}=\begin{cases}\mathcal{T}\left(w^{(t)}_{j}+\eta y^{(t)}x_{j}^{(t)},
g^{(t)}\eta,\theta\right),\text{ if }y^{(t)}\tilde{y}^{(t)}<1\\
\mathcal{T}\left(w^{(t)}_{j},g^{(t)}\eta,\theta\right),\text{ otherwise }\end{cases}$;
- (iii)
For least squares, $w^{(t)}_{j}=\mathcal{T}\left(w^{(t)}_{j}+2\eta\left(y^{(t)}-\tilde{y}^{(t)}
\right)x^{(t)}_{j},g^{(t)}\eta,\theta\right)$.

This computation takes $O(T)$ queries to the data input and requires $O(T+\log d)$ qubits and quantum gates.

We present our quantum algorithm for sparse online learning in Algorithm 1. Note that this quantum algorithm applies to logistic regression, the SVM and least squares when choosing their respective unitaries from Lemma 4.5 in Line 5.

Figure: Algorithm 1 Quantum algorithm for sparse online learning with truncated gradient descent

We emphasize that each entry of the weight vector can be efficiently computed, independently of the other entries as shown in Lemma 4.5. This includes the truncation step. Hence, it follows that the weight vectors need not be stored in qubits, thereby saving on the space/memory of the algorithm. For the inner product estimation, we access the entries of the weight vector by simply computing them, thanks to efficient unitaries for arithmetic computation and truncation. These entries, after the truncation, will not be entangled with auxiliary qubits.

###### Lemma 4.5 .

## 5 Convergence and Time Complexity Analysis

In this subsection, we analyze the regret and time complexity of Algorithm 1 applied to logistic regression, SVM, and least squares, respectively. We show that our quantum algorithms achieve a quadratic speedup in the data dimension $d$ over classical algorithms.

### 5.1 Quantum sparse online algorithm for logistic regression

The quantum sparse online algorithm for logistic regression is obtained by applying Algorithm 1 with Lemmas 4.5(i).
The regret is guaranteed by Theorem 5.1, with its proof deferred to Appendix C.2.

###### Theorem 5.1 (Regret for online logistic regression) .

Let $\delta\in(0,1)$. For all $t\in[T]$, let $\tilde{y}^{(t)}$ be an estimate of $\hat{y}^{(t)}=w^{(t)T}x^{(t)}$ to additive error $\epsilon_{\textup{IP}}$, and $\tilde{q}^{(t+1)}$ be an estimate of $q^{(t+1)}:=\|w^{(t+1)}\cdot I(|w^{(t+1)}|\leq\theta)\|_{1}$ to additive error $\epsilon_{\textup{norm}}$. Set $\eta=\frac{1}{C^{2}\sqrt{T}}$, $\epsilon_{\textup{norm}}=\frac{1}{2\eta T}$ and $\epsilon_{\textup{IP}}=\frac{1}{2\sqrt{T}}$. Under Assumption 1(iii), Algorithm 1 with Lemma 4.5(i) achieves a regret bound of

$$ $\displaystyle\frac{1}{T}\sum_{t=1}^{T}\ln\left(1+e^{-y^{(t)}\tilde{y}^{(t)}} \right)+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t)}-\frac{1}{T}\sum_{t=1}^ {T}\ln\left(1+e^{-y^{(t)}u^{T}x^{(t)}}\right)$ $\displaystyle-\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left\|u\cdot I\left(\left|w^{(t +1)}\right|\right)\right\|_{1}\leq\frac{1+C^{2}\left(2+g_{\max}+\|u^{*}\|^{2}_ {2}\right)}{2\sqrt{T}}$ $$

with success probability $1-\delta$ using $O\left(T^{5/2}\sqrt{d}\log\frac{T}{\delta}\right)$ queries, where $g_{\max}=\max_{t\in[T]}g^{(t)}$.

By taking $T=\Theta(C^{4}\|u^{*}\|_{2}^{4}/\epsilon^{2})$, the regret in Theorem 5.1 becomes $\Theta(\epsilon)$.
This implies a quantum algorithm for (offline) logistic regression with time complexity $\tilde{O}(C^{10}\|u^{*}\|_{2}^{10}\sqrt{d}/\epsilon^{5})$, which achieves an exponential improvement in the dependence on $C\|u^{*}\|_{2}$ compared to the prior best offline result $\tilde{O}(C^{2}\|u^{*}\|_{2}\exp(C\|u^{*}\|_{2})/\epsilon^{2})$ due to [].

###### Theorem 5.1 (Regret for online logistic regression) .

### 5.2 Quantum sparse online algorithm for SVM

The quantum sparse online algorithm for SVM is obtained by applying Algorithm 1 with Lemma 4.5(ii).
The regret is guaranteed by Theorem 5.2, with its proof deferred to Appendix C.3.

###### Theorem 5.2 (Regret for online hinge loss) .

Let $\delta\in(0,1)$. For all $t\in[T]$, let $\tilde{y}^{(t)}$ be an estimate of $\hat{y}^{(t)}=w^{(t)T}x^{(t)}$ to additive error $\epsilon_{\textup{IP}}$ and $\tilde{q}^{(t+1)}$ be an estimate of $q^{(t+1)}:=\left\|w^{(t+1)}\cdot I\left(\left|w^{(t+1)}\right|\leq\theta\right
)\right\|_{1}$ to additive error $\epsilon_{\textup{norm}}$. Set $\eta=\frac{1}{C^{2}T^{2}}$ and $\epsilon_{\textup{IP}}=\epsilon_{\textup{norm}}=\frac{1}{2\sqrt{T}}$. Under Assumption 1(iii), Algorithm 1 with Lemma 4.5(ii) achieves a regret bound of

$$ $\displaystyle\frac{1}{T}\sum_{t=1}^{T}\left(1-y^{(t)}\tilde{y}^{(t)}\right)^{+ }+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}-\frac{1}{T}\sum_{t=1}^{T} \left(1-y^{(t)}u^{T}x^{(t)}\right)^{+}$ $\displaystyle-\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left\|u\cdot I\left(\left|w^{(t +1)}\right|\right)\right\|_{1}\leq\frac{2+C^{2}\left(g_{\max}+\|u^{*}\|_{2}^{2 }\right)}{2\sqrt{T}}$ $$

with success probability $1-\delta$ using $O\left(T^{5/2}\sqrt{d}\log\frac{T}{\delta}\right)$ queries, where $g_{\max}=\max_{t\in[T]}g^{(t)}$.

By taking $T=\Theta(C^{4}\|u^{*}\|_{2}^{4}/\epsilon^{2})$, the regret in Theorem 5.2 becomes $\Theta(\epsilon)$.
This implies a quantum algorithm for (offline) SVM with time complexity $\tilde{O}(C^{10}\|u^{*}\|_{2}^{10}\sqrt{d}/\epsilon^{5})$, achieving a better dependence on $\epsilon$ than the prior best offline result $\tilde{O}(\sqrt{d}C^{2}\|u^{*}\|_{2}^{2}/\epsilon^{5}+\sqrt{d}/\epsilon^{8})$ due to [].

###### Theorem 5.2 (Regret for online hinge loss) .

### 5.3 Quantum sparse online algorithm for least squares

The quantum sparse online algorithm for least squares is obtained by applying Algorithm 1 with Lemma 4.5(iii).
It turns out that the quantum speedup appears when the prediction error is constant-bounded.
Here, the prediction error means the distance between true and predicted labels, which was also considered previously in the literature, e.g., [].
We formally state this condition as follows.

###### Assumption 2 (Constant-bounded prediction error) .

For any $t\in[T]$, let $y^{(t)}$ be the true label and let $\hat{y}^{(t)}=\sum_{j=1}^{d}w_{j}^{(t)}\cdot x_{j}^{(t)}$ be the predicted label. The prediction error is bounded by a constant $D\in\mathbb{R}_{+}$, such that for all $t$, $\left|y^{(t)}-\hat{y}^{(t)}\right|\leq D$.

Under Assumption 2, the regret is guaranteed by Theorem 5.3, with its proof in Appendix C.4.

###### Theorem 5.3 (Regret for online least squares) .

Let $\delta\in(0,1)$. Let $u\in\mathbb{R}^{d}$ be any vector and for $t\in[T]$, let $\tilde{y}^{(t)}$ be an estimate of $\hat{y}^{(t)}=w^{(t)T}x^{(t)}$ to additive error $\epsilon_{\textup{IP}}$ and $\tilde{q}^{(t+1)}$ be an estimate of $q^{(t+1)}:=\left\|w^{(t+1)}\cdot I\left(\left|w^{(t+1)}\right|\leq\theta\right
)\right\|_{1}$ to additive error $\epsilon_{\textup{norm}}$. Set $\eta=\frac{1}{C^{2}\sqrt{T}}$, $\epsilon_{\textup{IP}}=\frac{1}{2\sqrt{T}}$ and $\epsilon_{\text{norm}}=\frac{1}{2\eta T}$. Under Assumptions 1(iii) and 2, Algorithm 1 with Lemma 4.5(iii) achieves a regret bound of

$$ $\displaystyle\frac{1}{T}\sum_{t=1}^{T}\left(\tilde{y}^{(t)}-y^{(t)}\right)^{2} +\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}-\frac{1}{T}\sum_{t=1}^{T} \left(u^{T}x^{(t)}-y^{(t)}\right)^{2}$ $\displaystyle-\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left\|u\cdot I\left(\left|w^{(t +1)}\right|\leq\theta\right)\right\|_{1}\leq\frac{C^{2}\left(CD+g_{\max}+\|u^{ *}\|^{2}_{2}\right)}{\sqrt{T}}$ $$

with probability at least $1-\delta$ using $O\left(T^{5/2}\sqrt{d}\log\frac{T}{\delta}\right)$ queries, where $g_{\max}=\max_{t\in[T]}g^{(t)}$.

By setting $T=\Theta((C^{6}+C^{4}\|u^{*}\|_{2}^{4})/\epsilon^{2})$, the regret in Theorem 5.3 becomes $\Theta(\epsilon)$.
This implies a quantum algorithm for (offline) least squares with time complexity $\tilde{O}((C^{15}+C^{10}\|u^{*}\|_{2}^{10})\sqrt{d}/\epsilon^{5})$.
For comparison, we are aware of a quantum algorithm for offline least squares proposed in [] that considers different conditions and parameters.
Their algorithm has time complexity $\tilde{O}(s^{2}\kappa^{2}/\epsilon^{2})$, where $s$ denotes the sparsity of the data matrix and $\kappa$ is its condition number.

###### Assumption 2 (Constant-bounded prediction error) .

###### Theorem 5.3 (Regret for online least squares) .

## 6 Discussion and Conclusion

We propose a quantum online learning algorithm that outputs sparse solutions. Our quantum algorithm can be applied to logistic regression, the SVM and least squares. We show that the quantum algorithm achieves a quadratic speedup in the dimension of the problem as compared to its classical counterpart. The speedup stems from the use of quantum subroutines based on quantum amplitude estimation and amplification. We note that the speedup is only noticeable when $d\geq\Omega(T^{5}\log^{2}(T/\delta))$, which makes the algorithm useful for high-dimensional learning tasks. As our quantum algorithm is erroneous, it is natural that convergence is achieved after a greater number of steps as compared to its classical analogue. Our algorithm maintains a regret bound of the same order as compared to the classical algorithm of [], i.e. $O(1/\sqrt{T})$. We leverage unitaries that perform arithmetic computations, which allows us to save on the space/memory of the algorithm for storing the weight vector, which is $O(d)$ in [].

Despite our quantum algorithm having a running time that achieves quadratic improvement in the dimension $d$ of the weight vector, its dependence on the number of time steps $T$ increases. One natural question would be to ask if the trade-off between $T$ and $d$ can be avoided. Besides that, it would be interesting to explore how other variants of gradient descent such as mirror descent or stochastic gradient descent, combined with different “feature selection” techniques to obtain sparse solutions can contribute to an improvement in the regret bound. Considering that we have a unitary that computes entries of the weight vector that is updated via truncated gradient descent, one could consider potential applications of this unitary, for example in reinforcement learning []. On the other hand, one could explore possible applications of quantum algorithms in obtaining sparse solutions in the online learning setting as there has not been any work done in this regime. Instead of analyzing the (static) regret, one could consider studying the dynamic regret of the online algorithm which can be useful in scenarios where the optimal solution keeps changing in evolving environments [, , , , , , ].

## Acknowledgements

The authors acknowledge helpful discussions with Naixu Guo and Zhan Yu.

The work of Debbie Lim, Yixian Qiu, and Patrick Rebentrost was supported by the National Research Foundation, Singapore and A*STAR under its CQT Bridging Grant and its Quantum Engineering Programme under grant NRF2021-QEP2-02-P05. The work of Debbie Lim was also supported in part by the QuantERA Project QOPT and the Latvian Quantum Initiative under EU Recovery and Resilience Facility under project no. 2.3.1.1.i.0/1/22/I/CFLA/001.
The work of Qisheng Wang was supported by the Engineering and Physical Sciences Research Council under Grant EP/X026167/1.

## Appendix A Algorithms in Prior Work

The easiest algorithm for addressing unconstrained smooth optimization problems is gradient descent. For a convex and differentiable function $L:\mathbb{R}^{d}\rightarrow\mathbb{R}^{d}$, gradient descent iteratively updates the solution by moving in the direction of the negative gradient to minimize the objective function in unconstrained smooth optimization problems.

Figure: Algorithm 2 Gradient descent []

Gradient descent is modified to truncate the solution after $K$ steps to maintain its sparsity. The truncation is performed on entries of the solution that fall within a certain threshold value. This truncated solution is then used in the next iteration of gradient descent.

Algorithm 3 Truncated gradient descent []

Truncated gradient descent is used in the online learning framework to output sparse solutions. In every iteration $t\in[T]$, the algorithm receives an unlabelled example $x^{(t)}$, makes a prediction $\hat{y}^{(t)}$ on the label using the unlabelled example and the weight vector computed from the previous iteration. After that, it receives the true label $y^{(t)}$. The algorithm then updates its weight vector using truncated gradient descent.

Algorithm 4 Online sparse learning algorithm with truncated gradient descent []

## Appendix B Omitted Proofs in Section 4

### B.1 Proof of Lemma 4.2

Start with the state $\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert\theta\rangle
\lvert x\rangle\lvert 0\rangle\lvert 0\rangle\lvert 0\rangle\lvert 0\rangle$. Query the Between oracle on the third to sixth registers. Then,

- (i)
Condition on the sixth register being $\lvert 1\rangle$, flip the seventh register to flag that $0\leq x\leq\theta$, and do
$\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert\theta\rangle
\lvert x\rangle\lvert 1\rangle\lvert 1\rangle\lvert 0\rangle\lvert 0\rangle
\rightarrow\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert\theta
\rangle\lvert x\rangle\lvert 1\rangle\lvert 1\rangle\lvert x-\alpha\rangle
\lvert 0\rangle.$
Next, query the Minmax oracle on the seventh and eighth register to get
$\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert\theta\rangle
\lvert x\rangle\lvert 1\rangle\lvert 1\rangle\lvert x-\alpha\rangle\lvert 0
\rangle\rightarrow\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert
\theta\rangle\lvert x\rangle\lvert 1\rangle\lvert 1\rangle\lvert x-\alpha
\rangle\lvert\max(x-\alpha,0)\rangle.$
Lastly, swap the fifth and the last registers and uncompute intermediate registers.
- (ii)
Condition on the sixth register being $\lvert 0\rangle$, query the between oracle on the second, third, fifth and sixth registers. Then,
(i)
condition on the sixth being $\lvert 1\rangle$, do
$\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert\theta\rangle
\lvert x\rangle\lvert 1\rangle\lvert 0\rangle\lvert 0\rangle\lvert 0\rangle
\rightarrow\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert\theta
\rangle\lvert x\rangle\lvert 1\rangle\lvert 0\rangle\lvert x+\alpha\rangle
\lvert 0\rangle.$
Next, query the Minmax oracle on the eighth and ninth registers to get
$\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert\theta\rangle
\lvert x\rangle\lvert 1\rangle\lvert 0\rangle\lvert x+\alpha\rangle\lvert 0
\rangle\rightarrow\lvert\alpha\rangle\lvert-\theta\rangle\lvert 0\rangle\lvert
\theta\rangle\lvert x\rangle\lvert 1\rangle\lvert 0\rangle\lvert x+\alpha
\rangle\lvert\min(x+\alpha,0)\rangle.$
Lastly, swap the sixth and the last registers and uncompute intermediate registers.
(ii)
Condition on the sixth register being $\lvert 0\rangle$, do nothing.
Since we assume the use of the quantum arithmetic model, we hence obtain a running time of $\tilde{O}(1)$.

### B.2 Proof of Lemma 4.3

- (i)
Using the query access, create the circuit to prepare the state $\frac{1}{\sqrt{d}}\sum_{j=1}^{d}\lvert j\rangle\lvert u_{j}\rangle\lvert 0\rangle$. Use quantum maximum finding [] to find
$\lVert u\rVert_{\infty}:=\max_{j\in[d]}|u_{j}|$
with success probability $1-\delta/2$. Apply a controlled-rotation to the state obtains
$\displaystyle\frac{1}{\sqrt{d}}\sum_{j=1}^{d}\lvert j\rangle\lvert u_{j}
\rangle\left(\sqrt{\frac{|u_{j}|}{\lVert u\rVert_{\infty}}}\lvert 0\rangle+
\sqrt{1-\frac{|u_{j}|}{\lVert u\rVert_{\infty}}}\lvert 1\rangle\right).$
(2)
Let $U_{u}$ be the unitary that prepares the state in Eq. (2). Define new unitaries $U=U_{u}(I-2\lvert\bar{0}\rangle\langle\bar{0}\rvert)U_{u}^{\dagger}$ and $V=I-I\otimes\lvert 0\rangle\langle 0\rvert$. Fact 1 allows us to obtain an estimate $\tilde{a}$ of $a=\frac{\lVert u\rVert_{1}}{d\|u\|_{\infty}}$ such that $|\mathbb{E}[\tilde{a}]-a|\leq\frac{\epsilon_{0}^{2}}{32}a^{2}$
and $\operatorname{Var}(\tilde{a})\leq\frac{91a}{K^{2}}+\frac{\epsilon_{0}^{2}}{32}
a^{2}$, restoring the initial state with success probability at least $1-\frac{\epsilon_{0}^{2}}{32}a^{2}$, using $O\left(K\log\log K\log(K/\epsilon_{0})\right)$ expected number of applications of $U$ and $V$. Setting $K>\frac{8}{\epsilon_{0}}\sqrt{\frac{91}{a}}$ via exponential search without knowledge of $a$, by Chebyshev’s inequality we have
$\displaystyle\mathbb{P}\left[\lvert\tilde{a}-\mathbb{E}[\tilde{a}]\rvert\geq
\frac{\epsilon_{0}}{2}a\right]\leq\frac{4}{\epsilon_{0}^{2}a^{2}}\left(\frac{9
1a}{K^{2}}+\frac{\epsilon_{0}^{2}a^{2}}{32}\right)\leq\frac{4}{\epsilon_{0}^{2
}a^{2}}\left(\frac{\epsilon_{0}^{2}a^{2}}{64}+\frac{\epsilon_{0}^{2}a^{2}}{32}
\right)\leq\frac{1}{16}+\frac{1}{8}\leq\frac{1}{4}.$
The success probability $3/4$ is boosted with $O(\log\frac{1}{\delta})$ repetitions to $1-\delta/2$ via the median of means technique. Hence,
$\displaystyle\lvert\tilde{a}-a|\leq\lvert\tilde{a}-\mathbb{E}[\tilde{a}]\rvert
+\lvert\mathbb{E}[\tilde{a}]-a\rvert\leq\epsilon_{0}a/2+\epsilon_{0}a/2=
\epsilon_{0}a$
with success probability at least $1-4\delta$.
Hence the quantity $\tilde{\Gamma}:=\tilde{a}$ is an estimate
$\displaystyle\left|\tilde{\Gamma}-\frac{\|u\|_{1}}{d\lVert u\|_{\infty}}\right
|=\lvert\tilde{a}-a\rvert\leq\epsilon_{0}a.$
This brings the total time complexity to
$\displaystyle O\left(\frac{1}{\epsilon_{0}}\sqrt{\frac{d\|u\|_{\infty}}{\|u\|_
{1}}}\log\log\left(\frac{1}{\epsilon_{0}}\sqrt{\frac{d\|u\|_{\infty}}{\|u\|_{1
}}}\right)\log\left(\frac{1}{\epsilon_{0}^{2}}\left(\frac{d\|u\|_{\infty}}{\|u
\|_{1}}\right)^{3/2}\right)\log\frac{1}{\delta}\right)$
in expectation. While [] proves a result in expected time, we use the probabilistic result obtained from Markov’s inequality and repetition at a cost of another factor of $O\left(\log\frac{1}{\delta}\right)$.
We note that the additive version of norm estimation can be easily specialized by setting $K>\frac{8}{\epsilon_{0}}\sqrt{91a}$ and has the same time and gate complexity.
- (ii)
Note that the state in Eq. (2) can be rewritten as
$\sqrt{\frac{\lVert u\rVert_{1}}{\lVert u\rVert_{\infty}d}}\sum_{j=1}^{d}\lvert
j
\rangle\lvert u_{j}\rangle\left(\sqrt{\frac{|u_{j}|}{\lVert u\rVert_{1}}}
\lvert 0\rangle+\sqrt{1-\frac{|u_{j}|}{\lVert u\rVert_{1}}}\lvert 1\rangle
\right).$
Amplify the $\lvert 0\rangle$ part via amplitude amplification [] to obtain $|u\rangle=\sum_{j=1}^{d}\sqrt{\frac{|u_{j}|}{\lVert u\rVert_{1}}}\lvert j\rangle$ with success probability $1-\delta$ using $O\left(\sqrt{\frac{\lVert u\rVert_{\infty}d}{\lVert u\rVert_{1}}}\log\frac{1}{
\delta}\right)\subseteq O\left(\sqrt{d}\log\frac{1}{\delta}\right)$ calls to $U_{u}$ and $\tilde{O}\left(\sqrt{d}\log\frac{1}{\zeta}\log\frac{1}{\delta}\right)$ gates. For all $j\in[d]$, we have $\tilde{p}_{j}=\frac{u_{j}}{\tilde{\Gamma}}$. Also, note that $\lVert u\rVert_{1}-\tilde{\Gamma}\leq|\lVert u\rVert_{1}-\tilde{\Gamma}|\leq
\zeta\lVert u\rVert_{1}$, and hence $\frac{1}{\tilde{\Gamma}}\geq\frac{1}{\lVert u\rVert_{1}(1-\zeta)}$. Therefore,
$\displaystyle\left\lVert\tilde{p}-\frac{u}{\lVert u\rVert_{1}}\right\rVert_{1}
=\sum_{j=1}^{d}\left|\frac{u_{j}}{\tilde{\Gamma}}-\frac{u_{j}}{\lVert u\rVert_
{1}}\right|\leq\sum_{j=1}^{d}\left|\frac{u_{j}\cdot\zeta\lVert u\rVert_{1}}{
\lVert u\rVert_{1}\cdot(1-\zeta)\lVert u\rVert_{1}}\right|=\frac{\zeta}{(1-
\zeta)}\sum_{j=1}^{d}\left|\frac{u_{j}}{\lVert u\rVert_{1}}\right|=\frac{\zeta
}{(1-\zeta)}\leq 2\zeta.$

### B.3 Proof of Lemma 4.4

Define vectors $u^{+}$ and $u^{-}$ as follows

$$ $u^{+}_{i}=\begin{cases}u_{i},\text{ if }\text{sign}(u_{i})=1\\ 0,\text{ otherwise}\\ \end{cases},\hskip 85.35826ptu^{-}_{i}=\begin{cases}0,\text{ if }\text{sign}(u _{i})=1\\ -u_{i},\text{ otherwise}\\ \end{cases}$ $$

Notice that $u=u^{+}-u^{-}$. Define $v^{+}$ and $v^{-}$ in a similar way. Then

$$ $u\cdot v=u^{+}\cdot v^{+}+u^{-}\cdot v^{-}-u^{-}\cdot v^{+}-u^{+}\cdot v^{-}$ $$

Let $z^{+}$ and $z^{-}$ be vectors such that $z^{+}_{i}=u^{+}_{i}\cdot v^{+}_{i}+u^{-}_{i}\cdot v^{-}_{i}$ and $z^{-}_{i}=u^{+}_{i}\cdot v^{-}_{i}+u^{-}_{i}\cdot v^{+}_{i}$. Then, observe that

$$ $u\cdot v=\lVert z^{+}\rVert_{1}-\lVert z^{-}\rVert_{1}$ $$

Next, determine $z^{+}_{\max}:=\max_{j\in[d]}|z^{+}_{j}|$ using quantum maximum finding with success probability $1-\delta/4$ using $O\left(\sqrt{d}\log\frac{1}{\delta}\right)$ queries and $\tilde{O}\left(\sqrt{d}\log\frac{1}{\delta}\right)$ quantum gates []. If $z^{+}_{\max}=0$ up to sufficient numerical accuracy, then $\widetilde{IP}=0$ and we are done. Otherwise, use Lemma 4.3(i) to obtain an estimate $\tilde{\Gamma}_{z^{+}}$ of $\left\|\frac{z^{+}}{z^{+}_{\max}}\right\|_{1}$ such that

$$ $\left|\left\|\frac{z^{+}}{z^{+}_{\max}}\right\|_{1}-\tilde{\Gamma}_{z^{+}} \right|\leq\frac{\epsilon^{+}}{2}\left\|\frac{z^{+}}{z^{+}_{\max}}\right\|_{1}$ $$

with success probability at least $1-\delta/4$ with $\tilde{O}\left(\frac{1}{\epsilon^{+}}\sqrt{\frac{dz^{+}_{\max}}{\lVert z^{+}
\rVert_{1}}}\log\frac{1}{\delta}\right)\subseteq\tilde{O}\left(\frac{\sqrt{d}}
{\epsilon^{+}}\log\frac{1}{\delta}\right)$ queries and $\tilde{O}\left(\frac{\sqrt{d}}{\epsilon^{+}}\log\frac{1}{\delta}\right)$ quantum gates.

Similarly for the case of $z^{-}$, find $z^{-}_{\max}:=\max_{j\in[d]}|z^{-}|$ using quantum maximum finding with success probability $1-\delta/4$ using $O\left(\sqrt{d}\log\frac{1}{\delta}\right)$ queries and $\tilde{O}\left(\sqrt{d}\log\frac{1}{\delta}\right)$ quantum gates []. If $z^{-}_{\max}=0$ up to sufficient numerical accuracy, then $\widetilde{IP}=0$ and we are done. Otherwise, use Lemma 4.3(i) to obtain an estimate $\tilde{\Gamma}_{z^{-}}$ of $\left\|\frac{z^{-}}{z^{-}_{\max}}\right\|_{1}$ such that

$$ $\left|\left\|\frac{z^{-}}{z^{-}_{\max}}\right\|_{1}-\tilde{\Gamma}_{z^{-}} \right|\leq\frac{\epsilon^{-}}{2}\left\|\frac{z^{-}}{z^{-}_{\max}}\right\|_{1}$ $$

with success probability at least $1-\delta/4$ with $\tilde{O}\left(\frac{1}{\epsilon^{-}}\sqrt{\frac{dz^{+}_{\max}}{\lVert z^{+}
\rVert_{1}}}\log\frac{1}{\delta}\right)\subseteq O\left(\frac{\sqrt{d}}{
\epsilon^{-}}\log\frac{1}{\delta}\right)$ queries and $\tilde{O}\left(\frac{\sqrt{d}}{\epsilon^{-}}\log\frac{1}{\delta}\right)$ quantum gates.

Set $\widetilde{IP}=z^{+}_{\max}\tilde{\Gamma}_{z^{+}}-z^{-}_{\max}\tilde{\Gamma}_{
z^{-}}$. Then

$$ $\displaystyle\left|u\cdot v-\widetilde{IP}\right|$ $\displaystyle=\left|\lVert z^{+}\rVert_{1}-\lVert z^{-}\rVert_{1}-\left(z^{+}_ {\max}\tilde{\Gamma}^{+}-z^{-}_{\max}\tilde{\Gamma}^{-}\right)\right|$ (triangle ineq.) $\displaystyle\leq\left|\lVert z^{+}\rVert_{1}-z^{+}_{\max}\tilde{\Gamma}^{+} \right|+\left|\lVert z^{-}\rVert_{1}-z^{-}_{\max}\tilde{\Gamma}^{-}\right|$ (Lemma 4.3 ( i )) $\displaystyle\leq\frac{\epsilon^{+}}{2}\lVert z^{+}\rVert_{1}+\frac{\epsilon^{ -}}{2}\lVert z^{-}\rVert_{1}$ $\displaystyle=\frac{\epsilon^{+}}{2}\left(\|u^{+}\cdot v^{+}\|_{1}+\|u^{-} \cdot v^{-}\|_{1}\right)+\frac{\epsilon^{-}}{2}\left(u^{+}\cdot v^{-}+u^{-} \cdot v^{+}\right)$ (Hölder’s ineq.) $\displaystyle\leq\frac{\epsilon^{+}}{2}\left(\lVert u^{+}\rVert_{\infty}\lVert v ^{+}\rVert_{1}+\lVert u^{-}\rVert_{\infty}\lVert v^{-}\rVert_{1}\right)+\frac{ \epsilon^{-}}{2}\left(\lVert u^{+}\rVert_{\infty}\lVert v^{-}\rVert_{1}+\lVert u ^{-}\rVert_{\infty}\lVert v^{+}\rVert_{1}\right)$ $\displaystyle\leq\frac{\epsilon^{+}}{2}\|u\|_{\infty}\left(\|v^{+}\|_{1}+\|v^{ -}\|_{1}\right)+\frac{\epsilon^{-}}{2}\|u\|_{\infty}\left(\|v^{+}\|_{1}+\|v^{- }\|_{1}\right)$ $\displaystyle=\left(\frac{\epsilon^{+}}{2}+\frac{\epsilon^{-}}{2}\right)\|u\|_ {\infty}\|v\|_{1}$ $$

Setting $\epsilon^{+}=\epsilon^{-}=\frac{\epsilon}{\|u\|_{\infty}\|v\|_{1}}$ yields the desired result. The total time complexity is $\tilde{O}\left(\frac{\lVert u\rVert_{\infty}\lVert v\rVert_{1}\sqrt{d}}{
\epsilon}\log\frac{1}{\delta}\right)$.

### B.4 Proof of Lemma 4.5

With a computational register of $O(T)$ ancilla qubits for the examples, perform

$$ $\displaystyle\lvert j\rangle\lvert\bar{0}\rangle$ $\displaystyle\rightarrow\lvert j\rangle\lvert x^{(1)}_{j}\rangle\cdots\lvert x _{j}^{(t)}\rangle\lvert\bar{0}\rangle$ $\displaystyle\rightarrow\lvert j\rangle\lvert x^{(1)}_{j}\rangle\cdots\lvert x _{j}^{(t)}\rangle\lvert w_{j}^{\prime(1)}\rangle\lvert\bar{0}\rangle$ (3) $$

- (i)
For $t\in[T]$, let $w_{j}^{\prime(t)}=w_{j}^{(t-1)}+2\eta\left(y^{(t-1)}-\tilde{y}^{(t-1)}\right)x
_{j}^{(t-1)}$ and $w^{(t)}_{j}=\mathcal{T}\left(w_{j}^{\prime(t)},g^{(t)}\eta,\theta\right)$. Then, from Eq. (3), perform the following operations:
$\displaystyle\xrightarrow{U_{\mathcal{T},g^{(1)}\eta,\theta}}\lvert j\rangle
\lvert x^{(1)}_{j}\rangle\cdots\lvert x_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1
)}\rangle\lvert w_{j}^{(1)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\vdots$
$\displaystyle\rightarrow\lvert j\rangle\lvert x^{(1)}_{j}\rangle\cdots\lvert x
_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1)}\rangle\lvert w_{j}^{(1)}\rangle
\cdots\lvert w_{j}^{\prime(t)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\xrightarrow{U_{\mathcal{T},g^{(t)}\eta,\theta}}\lvert j\rangle
\lvert x^{(1)}_{j}\rangle\cdots\lvert x_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1
)}\rangle\lvert w_{j}^{(1)}\rangle\cdots\lvert w_{j}^{\prime(t)}\rangle\lvert w
_{j}^{(t)}\rangle$
- (ii)
For $t\in[T]$, let $w_{j}^{\prime(t)}=w_{j}^{(t-1)}+2\eta\frac{x_{j}^{(t)}y^{(t)}e^{-y^{(t)}\tilde
{y}^{(t)}}}{1+e^{-y^{(t)}\tilde{y}^{(t)}}}$ and $w_{j}^{(t)}=\mathcal{T}\left(w_{j}^{\prime(t)},g^{(t)}\eta,\theta\right)$. Then, from Eq. (3), perform the following operations:
$\displaystyle\xrightarrow{U_{\mathcal{T},g^{(1)}\eta,\theta}}\lvert j\rangle
\lvert x^{(1)}_{j}\rangle\cdots\lvert x_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1
)}\rangle\lvert w_{j}^{(1)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\vdots$
$\displaystyle\rightarrow\lvert j\rangle\lvert x^{(1)}_{j}\rangle\cdots\lvert x
_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1)}\rangle\lvert w_{j}^{(1)}\rangle
\cdots\lvert w_{j}^{\prime(t)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\xrightarrow{U_{\mathcal{T},g^{(t)}\eta,\theta}}\lvert j\rangle
\lvert x^{(1)}_{j}\rangle\cdots\lvert x_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1
)}\rangle\lvert w_{j}^{(1)}\rangle\cdots\lvert w_{j}^{\prime(t)}\rangle\lvert w
_{j}^{(t)}\rangle$
- (iii)
For $t\in[T]$, let
$w_{j}^{\prime(t)}=\begin{cases}w_{j}^{(t-1)}+\eta y^{(t-1)}x_{j}^{(t-1)},\text
{ if }y^{(t-1)}\tilde{y}^{(t-1)}<1\\
w_{j}^{(t-1)},\text{ otherwise}\end{cases}$
and $w_{j}^{(t)}=\mathcal{T}\left(w_{j}^{\prime(t)},g^{(t)}\eta,\theta\right)$. Then, from Eq. (3), perform the following operations:
$\displaystyle\lvert j\rangle\lvert\bar{0}\rangle$
$\displaystyle\rightarrow\lvert j\rangle\lvert x^{(1)}_{j}\rangle\cdots\lvert x
_{j}^{(t)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\rightarrow\lvert j\rangle\lvert x^{(1)}_{j}\rangle\cdots\lvert x
_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\xrightarrow{U_{\mathcal{T},g^{(1)}\eta,\theta}}\lvert j\rangle
\lvert x^{(1)}_{j}\rangle\cdots\lvert x_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1
)}\rangle\lvert w_{j}^{(1)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\vdots$
$\displaystyle\rightarrow\lvert j\rangle\lvert x^{(1)}_{j}\rangle\cdots\lvert x
_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1)}\rangle\lvert w_{j}^{(1)}\rangle
\cdots\lvert w_{j}^{\prime(t)}\rangle\lvert\bar{0}\rangle$
$\displaystyle\xrightarrow{U_{\mathcal{T},g^{(t)}\eta,\theta}}\lvert j\rangle
\lvert x^{(1)}_{j}\rangle\cdots\lvert x_{j}^{(t)}\rangle\lvert w_{j}^{\prime(1
)}\rangle\lvert w_{j}^{(1)}\rangle\cdots\lvert w_{j}^{\prime(t)}\rangle\lvert w
_{j}^{(t)}\rangle$

with sufficient accuracy using the oracles and quantum circuits for arithmetic operations. Uncomputing the intermediate registers will yield the desired result.

###### Remark B.1 .

For the addition of two integers each encoded in $k$-bit binary strings, the quantum circuit for addition has a Toffoli count of $2k-1$ and Toffoli depth of $k$ []. On the other hand, the quantum circuit for integer division has a Toffoli count of $14k^{2}+7k+7$ and a Toffoli depth of $10k+13$ while subtraction has a Toffoli count of $O(k)$ and a Toffoli depth of $O(1)$ []. Circuits for floating-point addition are generated using synthesis tools and can be hand-optimized as shown in  []. Furthermore, circuit sizes for floating-point division have been computed numerically by [], which improves upon the work of [] and []. In the above computation, we perform $T$ number of divisions and $T$ number of additions, which leads to a circuit of approximately $O(Tk^{2})$ size and $O(Tk)$ depth. Since we assume the use of the quantum arithmetic model, we hence obtain the $\tilde{O}(T+\log n)$ gate complexity.

###### Remark B.1 .

## Appendix C Omitted Proofs in Section 5

### C.1 A Fact for Regret Bounds

To complete our analysis, we need the following regret bounds given in [].

###### Fact 2 ( [ LLZ09 , Theorem 3.1] ) .

Suppose that Assumption 1 holds. Then, for all $u\in\mathbb{R}^{d}$, Algorithm A achieves

$$ $\displaystyle\frac{1-0.5A\eta}{T}\sum_{t=1}^{T}\left[L\left(w^{(t)},x^{(t)},y^ {(t)}\right)+\frac{g^{(t)}}{1-0.5A\eta}\left\|w^{(t+1)}\cdot I\left(\left|w^{( t+1)}\right|\leq\theta\right)\right\|_{1}\right]$ $\displaystyle\qquad\leq\frac{\eta}{2}B+\frac{\|u\|^{2}_{2}}{2\eta T}+\frac{1}{ T}\sum_{t=1}^{T}\left[L\left(u,x^{(t)},y^{(t)}\right)+g^{(t)}\left\|u\cdot I \left(\left|w^{(t+1)}\right|\leq\theta\right)\right\|_{1}\right].$ $$

###### Fact 2 ( [ LLZ09 , Theorem 3.1] ) .

### C.2 Proof of Theorem 5.1

We start by considering the following expression for the regret bound:

$$ $\displaystyle\frac{1}{T}\sum_{t=1}^{T}\ln\left(1+e^{-y^{(t)}\tilde{y}^{(t)}} \right)+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}$ $\displaystyle-\frac{1}{T}\sum_{t=1}^{T}\ln\left(1+e^{-y^{(t)}u^{T}x^{(t)}} \right)-\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left\|u\cdot I\left(\left|w^{(t+1)} \right|\right)\right\|_{1}.$ $$

Next, we simplify this by separating terms related to $\hat{y}^{(t)}$ and $\tilde{y}^{(t)}$ and apply Fact 2:

$$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}\ln\left(1+e^{-y^{(t)}\tilde{y}^{(t) }}\right)+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}$ $\displaystyle\qquad-\frac{1}{T}\sum_{t=1}^{T}\ln\left(1+e^{-y^{(t)}\hat{y}^{(t )}}\right)-\frac{1}{T}\sum_{t=1}^{T}g^{(t)}q^{(t+1)}+\frac{\eta C^{2}}{2}+ \frac{\lVert u\rVert_{2}^{2}}{2\eta T}$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}\left|\ln\left(1+e^{-y^{(t)}\tilde{y }^{(t)}}\right)-\ln\left(1+e^{-y^{(t)}\hat{y}^{(t)}}\right)\right|$ $\displaystyle\qquad+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left|\tilde{q}^{(t+1)}-q^ {(t+1)}\right|+\frac{\eta C^{2}}{2}+\frac{\lVert u\rVert_{2}^{2}}{2\eta T}.$ $$

Using additive variant of Lemma 4.3(i), we further simplify it:

$$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}\left|\ln\left(1+e^{-y^{(t)}\tilde{y }^{(t)}}\right)-\ln\left(1+e^{-y^{(t)}\hat{y}^{(t)}}\right)\right|+\frac{ \epsilon_{\text{norm}}}{T}\sum_{t=1}^{T}g^{(t)}+\frac{\eta C^{2}}{2}+\frac{ \lVert u\rVert_{2}^{2}}{2\eta T}.$ $$

Bounding $g^{(t)}$ by $g_{\max}$ gives us

$$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}\left|\ln\left(1+e^{-y^{(t)}\tilde{y }^{(t)}}\right)-\ln\left(1+e^{-y^{(t)}\hat{y}^{(t)}}\right)\right|+g_{\max} \epsilon_{\text{norm}}+\frac{\eta C^{2}}{2}+\frac{\lVert u\rVert_{2}^{2}}{2 \eta T}.$ $$

Finally, by applying the inequality $\ln(1+x)\leq x\text{ for }x>-1$ and leveraging Lipschitz continuity, as well as Lemma 4.4, we obtain:

$$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}e\epsilon_{\text{IP}}+g_{\max} \epsilon_{\text{norm}}+\frac{\eta C^{2}}{2}+\frac{\lVert u\rVert_{2}^{2}}{2 \eta T}$ $\displaystyle=e\epsilon_{\text{IP}}+g_{\max}\epsilon_{\text{norm}}+\frac{\eta C ^{2}}{2}+\frac{\lVert u\rVert_{2}^{2}}{2\eta T}.$ $$

Setting $\epsilon_{\text{IP}}=\frac{1}{4\eta T}$, $\epsilon_{\text{norm}}=\frac{1}{2\eta T}$ and $\eta=\frac{1}{C^{2}\sqrt{T}}$, the desired regret bound is achieved with success probability $1-\delta$ by the union bound when quantum inner product and norm estimation each succeeds with probability $1-\delta/2$.

Finally, we compute the total time complexity of the algorithm. The algorithm uses the following subroutines, each with the correspoinding running time:

$$ $\displaystyle T\left(\text{quantum inner product estimation + quantum norm estimation + quantum state preparation}\right)$ $\displaystyle\subseteq O\left(T\left(\frac{T\sqrt{d}}{\epsilon_{IP}}\log\frac{ T}{\delta}+\frac{T\sqrt{d}}{\epsilon_{\text{norm}}}\log\frac{T}{\delta}+T\sqrt {d}\log\frac{T}{\delta}\right)\right)\subseteq O\left(T^{5/2}\sqrt{d}\log\frac {T}{\delta}\right).$ $$

### C.3 Proof of Theorem 5.2

We start by considering the following expression for the regret bound:

$$ $\displaystyle\frac{1}{T}\sum_{t=1}^{T}\left(1-y^{(t)}\tilde{y}^{(t)}\right)^{+ }+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}$ $\displaystyle-\frac{1}{T}\sum_{t=1}^{T}\left(1-y^{(t)}u^{T}x^{(t)}\right)^{+}- \frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left\|u\cdot I\left(\left|w^{(t+1)}\right| \right)\right\|_{1}.$ $$

Next, we separate the terms for terms for $\hat{y}^{(t)}$ and $\tilde{y}^{(t)}$ and apply Fact 2:

$$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}\left(1-y^{(t)}\tilde{y}^{(t)}\right )^{+}+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}$ $\displaystyle\qquad-\frac{1}{T}\sum_{t=1}^{T}\left(1-y^{(t)}\hat{y}^{(t)} \right)^{+}-\frac{1}{T}\sum_{t=1}^{T}g^{(t)}q^{(t+1)}+\frac{C^{2}\lVert u \rVert_{2}^{2}}{2\sqrt{T}}+\frac{1}{2\sqrt{T}}$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}\left|\left(1-y^{(t)}\tilde{y}^{(t)} \right)^{+}-\left(1-y^{(t)}\hat{y}^{(t)}\right)^{+}\right|$ $\displaystyle\qquad+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left|\tilde{q}^{(t+1)}-q^ {(t+1)}\right|+\frac{C^{2}\lVert u\rVert_{2}^{2}}{2\sqrt{T}}+\frac{1}{2\sqrt{T }}.$ $$

Using additive variant of Lemma 4.3(i) and $g_{\max}=\max_{t\in[T]}g^{(t)}$, we obtain:

$$ $\displaystyle\leq\frac{1}{T}\sum_{t=1}^{T}\left|\left(1-y^{(t)}\tilde{y}^{(t)} \right)^{+}-\left(1-y^{(t)}\hat{y}^{(t)}\right)^{+}\right|+\epsilon_{\text{ norm}}g_{\max}+\frac{C^{2}\lVert u\rVert_{2}^{2}}{2\sqrt{T}}+\frac{1}{2\sqrt{T }}.$ $$

We finally obtain the bound by using Lipschitz continuity and Lemma 4.4:

$$ $\displaystyle\leq|\hat{y}^{(t)}-\tilde{y}^{(t)}|+\epsilon_{\text{norm}}g_{\max }+\frac{C^{2}\lVert u\rVert_{2}^{2}}{2\sqrt{T}}+\frac{1}{2\sqrt{T}}$ $\displaystyle\leq\epsilon_{\text{IP}}+\epsilon_{\text{norm}}g_{\max}+\frac{C^{ 2}\lVert u\rVert_{2}^{2}}{2\sqrt{T}}+\frac{1}{2\sqrt{T}}$ $\displaystyle\leq\frac{2+C^{2}\left(g_{\max}+\|u\|_{2}^{2}\right)}{2\sqrt{T}}$ $$

when setting $\epsilon_{\text{IP}}=\frac{1}{2\sqrt{T}}$, $\epsilon_{\text{norm}}=\frac{1}{2\eta T}$ and $\eta=\frac{1}{C^{2}\sqrt{T}}$. This succeeds with probability $1-\delta$ by the union bound when quantum inner product and norm estimation each succeeds with probability $1-\delta/2$.

The time complexity analysis is the same as that of Theorem 5.1.

### C.4 Proof of Theorem 5.3

We start by considering the following expression for the regret bound:

$$ $\displaystyle\frac{1-2C^{2}\eta}{T}\sum_{t=1}^{T}\left(\tilde{y}^{(t)}-y^{(t)} \right)^{2}+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}$ $\displaystyle-\frac{1}{T}\sum_{t=1}^{T}\left(u^{T}x^{(t)}-y^{(t)}\right)^{2}- \frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left\|u\cdot I\left(\left|w^{(t+1)}\right| \leq\theta\right)\right\|_{1}.$ $$

At this point, we apply Fact 2 to obtain the following bound:

$$ $\displaystyle\leq\frac{1-2C^{2}\eta}{T}\sum_{t=1}^{T}\left(\tilde{y}^{(t)}-y^{ (t)}\right)^{2}+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\tilde{q}^{(t+1)}$ $\displaystyle\qquad-\frac{1-2C^{2}\eta}{T}\sum_{t=1}^{T}\left(\hat{y}^{(t)}-y^ {(t)}\right)^{2}-\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\left\|w^{(t+1)}\cdot I\left( \left|w^{(t+1)}\right|\leq\theta\right)\right\|_{1}+\frac{\lVert u\rVert_{2}^{ 2}}{2\eta T}.$ $$

Next, we separate the terms to focus on the error:

$$ $\displaystyle\leq\frac{1-2C^{2}\eta}{T}\sum_{t=1}^{T}\left|\left(\tilde{y}^{(t )}-y^{(t)}\right)^{2}-\left(\hat{y}^{(t)}-y^{(t)}\right)^{2}\right|+\frac{1}{T }\sum_{t=1}^{T}g^{(t)}\left|\tilde{q}^{(t+1)}-q^{(t+1)}\right|+\frac{\lVert u \rVert_{2}^{2}}{2\eta T}.$ $$

Use Lipschitz continuity to further bound it:

$$ $\displaystyle\leq\frac{(1-2C^{2}\eta)\epsilon_{\text{IP}}}{T}\sum_{t=1}^{T}2 \left|\hat{y}^{(t)}-y^{(t)}\right|\left\|x^{(t)}\right\|_{2}+\frac{1}{T}\sum_{ t=1}^{T}g^{(t)}\left|\tilde{q}^{(t+1)}-q^{(t+1)}\right|+\frac{\lVert u\rVert_{ 2}^{2}}{2\eta T}.$ $$

By additive variant of Lemma 4.3(i), now we have:

$$ $\displaystyle\leq\frac{(1-2C^{2}\eta)\epsilon_{\text{IP}}}{T}\sum_{t=1}^{T}2 \left|\hat{y}^{(t)}-y^{(t)}\right|\left\|x^{(t)}\right\|_{2}+\frac{1}{T}\sum_{ t=1}^{T}g^{(t)}\epsilon_{\text{norm}}+\frac{\lVert u\rVert_{1}}{2\eta T}.$ $$

Applying Assumption 1(iii), we can simplify it:

$$ $\displaystyle\leq\frac{2C\epsilon_{\text{IP}}(1-2C^{2}\eta)}{T}\sum_{t=1}^{T} \left|\hat{y}^{(t)}-y^{(t)}\right|+\frac{1}{T}\sum_{t=1}^{T}g^{(t)}\epsilon_{ \text{norm}}+\frac{\lVert u\rVert_{2}^{2}}{2\eta T}.$ $$

Finally, we apply $g_{\max}=\max_{t\in[T]}g^{(t)}$ and Assumption 2 to obtain:

$$ $\displaystyle\leq\frac{2C\epsilon_{\text{IP}}(1-2C^{2}\eta)}{T}\sum_{t=1}^{T} \left|\hat{y}^{(t)}-y^{(t)}\right|+\frac{\epsilon_{\text{norm}}}{T}\sum_{t=1}^ {T}g_{\max}+\frac{\lVert u\rVert_{2}^{2}}{2\eta T}$ $\displaystyle\leq 2C\epsilon_{\text{IP}}(1-2C^{2}\eta)D+\epsilon_{\text{norm}} g_{\max}+\frac{\lVert u\rVert_{2}^{2}}{2\eta T}$ $\displaystyle\leq 2CD\epsilon_{\text{IP}}+\epsilon_{\text{norm}}g_{\max}+\frac {\lVert u\rVert_{2}^{2}}{2\eta T}$ $$

with success probability $1-\delta$ by the union bound when quantum inner product and norm estimation each succeeds with probability $1-\delta/2$. By setting $\epsilon_{\text{IP}}=\frac{1}{4\eta T}$, $\epsilon_{\text{norm}}=\frac{1}{2\eta T}$ and $\eta=\frac{1}{C^{2}\sqrt{T}}$, we obtain the desired bound.

The time complexity analysis is the same as that of Theorem 5.1.

## Peer Reviews

confidence: 1
contribution: 3
initial_rating: 6
presentation: 4
questions: Can you give an intuitive explanation of the dependance between $T$ and $d$?
soundness: 3
strengths: The article is easy to read and very clear even for someone not very knowledgeable about quantum computations.
I am not up to date in the literature, so I cannot comment on significance or originality.
summary: The authors study a quantum algorithm for online learning with a truncated version of gradient descent. This algorithm is already well studied in its classical form and going to its quantum counterpart one maintains the same regret rate, but with significantly smaller time complexity.
weaknesses: The paper doesn't discuss how feasible it is to implement such an algorithm. Its advantage on the classical counterpart comes into play only for large $d$, which can make it harder to run this algorithm in practice. It also seem to me that running such an algorithm for large $T$ may accumulate a large number of errors.

---

confidence: 2
contribution: 2
initial_rating: 5
presentation: 3
questions: 1.	Applicability to Nonlinear Models: Please clarify whether the method can be extended to nonlinear models. If not, specify its limitations.

2.	Input and Output of Algorithm 1: Please define the inputs and outputs of Algorithm 1 to facilitate understanding and reproducibility.
soundness: 3
strengths: The authors provide thorough theoretical analysis for the proposed method, which demonstrates greater practicality compared to the baseline approach. The research is foundational and has the potential to inspire other studies.
summary: This manuscript presents a quantum sparse online learning algorithm for logistic regression, SVM, and least squares, building on the work of Langford et al. (2009). The authors demonstrate that the proposed algorithm achieves a quadratic speedup in time complexity, assuming efficient quantum access to inputs. While the manuscript provides substantial theoretical analysis, it lacks empirical evaluation to validate the conclusions, which makes the proposed method less persuasive.
weaknesses: 1. The manuscript lacks essential empirical studies, which reduces the persuasiveness of the proposed approach.

2. The baseline method is somewhat outdated, which could detract from the relevance of the proposed work.

3. The authors should strengthen the explanation of the research motivation to make the study more compelling.

4. The authors should provide an introductory explanation of quantum algorithms at the beginning of the article, and the related work section should cover recent advancements in truncated gradient descent and quantum algorithms.

5. There is discrepency in the notation for transposition and iteration (T), and a typo is present in Assumption 1.

---

confidence: 2
contribution: 2
initial_rating: 3
presentation: 1
questions: - What does an exponential improvement in the dependence on $\\|u^\star\\|_2$ refer to on Page 4? The standard algorithm only has a polynomial dependence.
- Why does the gravity parameter $\alpha$ depend on the learning rate $\eta$?
- Does the speedup arise from the assumption that features and weights can be accessed in  $\tilde{O}(1)$ time coherently on a quantum computer, rather than the novelty of the proposed algorithm itself?
- Assumption 1 (ii) assumes $A,B \in \mathbb{R}_{>0}$ but $A$ or $B$ can be zero in the examples below.
soundness: 2
strengths: The proposed algorithm achieves a reduced time complexity in the case the sample size $T$ is smaller than $\tilde O(d^{1/5})$, while attaining the same regret bound.
summary: This paper developed a quantum sparse online learning algorithm by using truncated gradient descent. The time complexity is improved on the dependence on the data dimension. Applications to logistic regression, SVMs, and least squares are discussed.
weaknesses: The presentation of the paper requires significant improvement. The flow lacks coherence, making it challenging to understand the paper's focus. 

More importantly, it allocates substantial space to well-known models, such as regression and SVM, while providing limited attention to quantum computing and algorithms. The preliminaries on quantum computing are far from sufficient, which severely impacts the paper’s readability. For instance, $O_u|j\rangle|\bar{0}\rangle = |j\rangle |u_j\rangle$ in Section 3 and various notations/definitions in Section 4 are not accessible to readers in the machine learning field who might not have a background in quantum computing. 

As someone who is not an expert in quantum computing, the paper’s lack of readability prevents me from confidently assessing the validity of the results or accurately evaluating its contributions. It is not clear to me whether the theoretical improvement is due to the quantum computing assumptions or the novelty of the proposed algorithm.

---

confidence: 2
contribution: 2
initial_rating: 5
presentation: 3
questions: Please see the weakness above.
soundness: 2
strengths: * The proposed method exhibits better time complexity when $d > O(T^5)$.
* Theoretical guarantees for the achievable regrets are provided.
summary: This paper develops new quantum online learning algorithms for logistic regression, SVM and least square problems. The work is based on the pioneering work of (Langford et al. 2009), utilizing a truncated gradient descent algorithm for sparse online learning. The developed method achieves the same regret bound while improving the time complexity from $O(Td)$ to $O(T^{5/2}\sqrt{d})$, allowing speedup when $d > O(T^5)$.
weaknesses: * I'm not familiar with quantum algorithms, but to the best of my experience the data dimension $d$ and time step $T$ are usually at the same scale of magnitude for traditional deep learning, so I wonder how often will $d > O(T^5)$ actually happen in practice. I'll suggest the authors give some high-dimensional learning examples to motivate this improvement.

* There are no empirical results provided in the current version of the manuscript, which makes it hard for me to understand how much improvement could be brought by the method designed in this paper. I would consider raising my score if the authors could provide some empirical comparison between their method and the one in (Langford et al. 2009).

---

confidence: 2
contribution: 2
initial_rating: 5
presentation: 3
questions: This paper uses the same assumption (Assumption 1) as Langford et al. (2009). Besides that, this paper also introduces Assumption 2. Is this assumption also used in Langford et al. (2009)? If not, then will this make the comparison being unfair?
soundness: 3
strengths: 1. This paper gives a very clear presentation of the differences between their results and previous works. It applies the techniques of quantum amplitude estimation and amplification: ``quantum inner product estimation, quantum norm estimation, and quantum state preparation''. The improvement in time complexity is vital in our big data era, so the problem under the high-dimensional learning condition does match with the current focus.

2. Besides that, the three problems studied in this paper, logistic regression, support vector machine (SVM), and least squares, are very popular approaches used in machine learning. It is imperative to develop these as it has the potential to influence various fields.
summary: In this paper, it presents quantum algorithms for studying the sparse online learning, and it can be applied to well-known machine learning problems, like logistic regression, the SVM, and least squares. This paper is built upon the seminal work of Langford et al. (2009), and it achieves a quadratic speedup in the time complexity: they get $\widetilde{O}(T^{5 / 2} \sqrt{d})$, where $T$ is the number of iterations and $d$ is the dimension of the data point. This time complexity improves from $O(Td)$ from Langford et al. (2009), under the assumption that $d > \widetilde{\Omega} (T^5)$ (for high-dimensional learning tasks). This time complexity is fairly compared with Langford et al. (2009) since they have the same regret $O(1 / \sqrt{T})$.
weaknesses: 1. However, it is unclear what the unique theoretical novelties of this paper are. While the authors provide a comprehensive overview of techniques adopted from other works, they lack a clear explanation of their own theoretical contributions. It is common for theoretical papers to defer proofs to the appendix. However, instead of merely stating the theorems, it is more important to present a high-level overview (or proof sketch) of how to establish these results, allowing readers to better understand the theoretical innovations of this work.

2. This paper misuses many instances of \citep and \citet.

3. While the size of datasets in practice continues to grow, and the authors cite numerous works (lines 74 to 77) that emphasize the significance of their contributions in the era of big data, it remains unclear under what circumstances, in practice, $d > \widetilde{\Omega}(T^5)$. I suggest that the authors include specific examples (with citations) where $d > \widetilde{\Omega}(T^5)$ is common in practice, as this would make the impact of their work more convincing.

Meta-review: This paper presents a quantum algorithm for sparse online logistic regression. While reviewers found merits in the paper, the general agreement is that the novelty is limited by the fact that the authors method only improves on classical algorithms in a narrow parameter regime (very high dimensional data compared to number of samples). Since this is a purely theoretical paper, such an improvement might fit better at a more specialized venue on quantum algorithms or quantum ML.

Decision: Reject