# Superadiabatic Controlled Evolutions and Universal Quantum Computation

Alan C. Santos  Instituto de Física, Universidade Federal Fluminense, Av.
General Milton Tavares de Souza, Gragoatá, 24210-346,Niterói, RJ, Brazil
<EMAIL_ADDRESS>Marcelo S. Sarandy  Instituto de Física, Universidade Federal
Fluminense, Av. General Milton Tavares de Souza, Gragoatá, 24210-346,Niterói,
RJ, Brazil  Center for Quantum Information Science & Technology and Ming Hsieh
Department of Electrical Engineering, University of Southern California, Los
Angeles, California 90089, USA<EMAIL_ADDRESS>
###### Abstract

Adiabatic state engineering is a powerful technique in quantum information and
quantum control. However, its performance is limited by the adiabatic theorem
of quantum mechanics. In this scenario, shortcuts to adiabaticity, such as
provided by the superadiabatic theory, constitute a valuable tool to speed up
the adiabatic quantum behavior. Here, we propose a superadiabatic route to
implement universal quantum computation. Our method is based on the
realization of piecewise controlled superadiabatic evolutions. Remarkably,
they can be obtained by simple time-independent counter-diabatic Hamiltonians.
In particular, we discuss the implementation of fast rotation gates and
arbitrary n-qubit controlled gates, which can be used to design different sets
of universal quantum gates. Concerning the energy cost of the superadiabatic
implementation, we show that it is dictated by the quantum speed limit,
providing an upper bound for the corresponding adiabatic counterparts.

##  I Introduction

Quantum adiabatic processes are a powerful strategy to implement quantum state
engineering, which aims at manipulating a quantum system to attain a target
state at a designed time T. In the adiabatic scenario, the quantum system
evolves under a sufficiently slowly-varying Hamiltonian, which prevents
changes in the populations of the energy eigenlevels. In particular, if the
system is prepared in an eigenstate $|n(0)\rangle$ of the Hamiltonian $H$ at a
time $t=0$, it will evolve to the corresponding instantaneous eigenstate
$|n(t)\rangle$ at later times. This transitionless evolution is ensured by the
adiabatic theorem, which is one of the oldest and most explored tools in
quantum mechanics Born:28 ; Kato:50 ; Messiah:book  . The huge amount of
applications of the adiabatic behavior has motivated renewed interest in the
adiabatic theorem, which has implied in its rigorous formulation Teufel:03 ;
Ambainis:04 ; Tong:05 ; Jansen:07 ; Amin:09 ; Tong:10 ; Cao:13  as well as in
new bounds for adiabaticity Tong:07 ; Yu:14 ; Wang:15  . In quantum
information processing, the adiabatic theorem is the basis for the methodology
of adiabatic quantum computation (AQC) Farhi:01  , which has been originally
proposed as an approach for the solution of hard combinatorial search
problems. More generally, AQC has been proved to be universal for quantum
computing, being equivalent to the standard circuit model of quantum
computation up to polynomial resource-overhead Aharonov:04  . Moreover, it is
a physically appealing approach, with a number of experimental implementations
in distinct architectures, e.g., nuclear magnetic resonance Steffen:03 ;
Peng:08 ; Long:13  , ion traps Richerme:13  , and superconducting flux quantum
bits (qubits) through the D-Wave quantum annealer Johnson:11 ; Boixo:13 ;
Boixo:14  .

Recently, the circuit model has been directly connected with AQC via hybrid
approaches Bacon:09 ; Hen:15  . Then, an adiabatic circuit can be designed
based on the adiabatic realization of quantum gates, which allows for the
translation of the quantum circuit to the AQC framework with no further
resources required. In particular, it is possible to implement universal sets
of quantum gates through controlled adiabatic evolutions (CAE) Hen:15  . In
turn, CAE are used to perform one-qubit and two-qubit gates, allowing for
universality through the set of one-qubit rotations joint with an entangling
two-qubit gate Barenco:95 ; Nielsen:book  . However, since these processes are
ruled by the adiabatic approximation, it turns out that each gate of the
adiabatic circuit will be implemented within some fixed probability (for a
finite evolution time). Moreover, the time for performing each individual gate
will be bounded from below by the adiabatic time condition Teufel:03 ;
Ambainis:04 ; Tong:05 ; Jansen:07 ; Amin:09 ; Tong:10 ; Cao:13  . For a recent
analysis on adiabatic control of quantum gates and its corresponding non-
adiabatic errors, see Ref. Martinis:14  .

In order to resolve the limitations of adiabaticity in the hybrid model, we
propose here a general shortcut to CAE through simple time-independent
counter-diabatic assistant Hamiltonians within the framework of the
superadiabatic theory Demirplak:03 ; Demirplak:05 ; Berry:09 ; Torrontegui:13
. The physical resources spent by this strategy will be governed by the
quantum circuit complexity, but no adiabatic constraint will be required in
the individual implementation of the quantum gates. Moreover, the gates will
be deterministically implemented with probability one as long as decoherence
effects can be avoided. In particular, we discuss the realization of rotation
gates and arbitrary n-qubit controlled gates, which can be used to design
different sets of universal quantum gates. This analog approach allows for
fast implementation of individual gates, whose time consumption is only
dictated by the quantum speed limit (QSL) (for closed systems, see Refs.
Mandelstam:45 ; Margolus:98 ; Giovannetti:03 ; Deffner:13 ). Indeed, the time
demanded for each gate will imply in an energy cost, which increases with the
speed of the evolution. In this context, by analyzing the energy-time
complementarity, we will show that the QSL provides an energy cost for
superadiabatic evolutions that upper bounds the cost of adiabatic
implementations.

##  II Adiabatic quantum circuits

Let us begin by discussing the design of adiabatic quantum circuits as
introduced by Hen Hen:15  through the implementation of quantum gates via CAE.

###  II.1 Controlled adiabatic evolution

In order to define quantum gates through CAE, we will introduce a discrete
bipartite system ${\cal SA}$ associated with a Hilbert space ${\cal H}_{\cal
S}\otimes{\cal H}_{\cal A}$. The system ${\cal SA}$ is composed by a target
subsystem ${\cal S}$ and an auxiliary subsystem ${\cal A}$, whose individual
Hilbert spaces ${\cal H}_{\cal S}$ and ${\cal H}_{\cal A}$ have dimensions
$d_{\cal S}$ and $d_{\cal A}$, respectively. The dynamics of ${\cal SA}$ will
be governed by a Hamiltonian in the form Hen:15

$H\left(t\right)=f\left(t\right)\left[\mathbbm{1}\otimes
H^{\left(b\right)}\right]+g\left(t\right)\left[\sum\nolimits_{k}P_{k}\otimes
H_{k}^{\left(f\right)}\right],$ (1)

where $f\left(0\right)=g\left(1\right)=1$,
$g\left(0\right)=f\left(1\right)=0$, and $\left\\{P_{k}\right\\}$ denotes a
complete set of orthogonal projectors over ${\cal S}$, so that they satisfy
$P_{k}P_{m}=\delta_{km}P_{k}$ and $\sum_{k}P_{k}=1$. Alternatively, we can
write Eq. (1) as

$H\left(t\right)=\sum\nolimits_{k}P_{k}\otimes H_{k}\left(t\right),$ (2)

with
$H_{k}\left(t\right)=g\left(t\right)H_{k}^{\left(f\right)}+f\left(t\right)H^{\left(b\right)}$
denoting a Hamiltonian that acts on ${\cal A}$. Suppose now that we prepare
the system ${\cal SA}$ in the initial state
$\left|\Psi_{init}\right\rangle=\left|\psi\right\rangle\otimes\left|\varepsilon_{b}\right\rangle$,
where $\left|\psi\right\rangle$ is an arbitrary state of ${\cal S}$ and
$\left|\varepsilon_{b}\right\rangle$ is the (non-degenerate) ground state of
$H^{\left(b\right)}$. Then $\left|\Psi_{init}\right\rangle$ is the ground
state of the initial Hamiltonian $\mathbbm{1}\otimes H^{\left(b\right)}$. By
applying the adiabatic theorem Messiah:book ; Sarandy:04  , a sufficiently
slowing-varying evolution of $H(t)$ will drive the system (up to a phase) to
the final state

$\left|\Psi_{final}\right\rangle=\sum\nolimits_{k}P_{k}\left|\psi\right\rangle\otimes\left|\varepsilon_{k}\right\rangle,$
(3)

where $\left|\varepsilon_{k}\right\rangle$ is the ground state of
$H_{k}^{\left(f\right)}$ Hen:15  .

####  II.1.1 Single-qubit unitaries and controlled two-qubit gates

We can perform a single-qubit unitary transformation through a general
rotation of an angle $\phi$ around a direction $\hat{n}$ on the Bloch sphere.
In this direction, we begin by preparing the system ${\cal SA}$, taken here as
two qubits, in the initial state
$\left|\psi\right\rangle\otimes\left|0\right\rangle$, where
$\\{|0\rangle,|1\rangle\\}$ are the computational states of the auxiliary
system ${\cal A}$. Then, we let the system adiabatically evolve driven by the
Hamiltonian Hen:15

$H\left(s\right)=\left|\hat{n}_{+}\right\rangle\left\langle\hat{n}_{+}\right|\otimes
H_{0}\left(s\right)+\left|\hat{n}_{-}\right\rangle\left\langle\hat{n}_{-}\right|\otimes
H_{\phi}\left(s\right),$ (4)

where $H_{0}(s)$ and $H_{\phi}(s)$ are adiabatically-evolved Hamiltonians,
whose effect will be restricted to the respective subspaces of the projectors
$\left|\hat{n}_{\pm}\right\rangle\left\langle\hat{n}_{\pm}\right|=\frac{1}{2}\left(1\pm\hat{n}\cdot\vec{\sigma}\right)$,
where $\hat{n}$ is a unitary vector on the Bloch sphere associated with ${\cal
S}$ and $\vec{\sigma}=\left(\sigma_{x},\sigma_{y},\sigma_{z}\right)$, with
$\\{\sigma_{i}\\}$ denoting the set of Pauli matrices. The Hamiltonians are
taken as
$H_{\xi}\left(s\right)=-\omega\hbar\left\\{\sigma_{z}\cos(\theta_{0}s)+\sin(\theta_{0}s)\left[\sigma_{x}\cos\xi+\sigma_{y}\sin\xi\right]\right\\}$,
where ${\xi}\in\\{0,\phi\\}$, $\omega\hbar$ sets the energy scale
($\omega>0$), $\theta_{0}$ is a constant parameter, and $s=t/\tau$ denotes a
dimensionless (parametrized) time, with $\tau$ the total time of evolution.
Note then that

$\displaystyle H_{0}\left(s\right)$ $\displaystyle=$
$\displaystyle-\omega\hbar\left\\{\sigma_{z}\cos\left(\theta_{0}s\right)+\sigma_{x}\sin\left(\theta_{0}s\right)\right\\},$
$\displaystyle H_{\phi}\left(s\right)$ $\displaystyle=$
$\displaystyle-\omega\hbar\left\\{\sigma_{z}\cos(\theta_{0}s)+\sin(\theta_{0}s)\left[\sigma_{x}\cos\phi+\sigma_{y}\sin\phi\right]\right\\}.$

By writing the initial state of ${\cal SA}$ as
$\left|\Psi_{init}\right\rangle=\left|\psi\right\rangle\otimes|0\rangle=\left(\alpha\left|\hat{n}_{+}\right\rangle+\beta\left|\hat{n}_{-}\right\rangle\right)\otimes|0\rangle$,
where $|\psi\rangle$ is an arbitrary (not necessarily known) qubit state, the
final state $|\Psi_{final}\rangle$ follows from Eq. (3), i.e.
$\left|\Psi_{final}\right\rangle=\alpha\left|\hat{n}_{+}\right\rangle\otimes\left|\varepsilon^{-}_{0}\right\rangle+\beta\left|\hat{n}_{-}\right\rangle\otimes\left|\varepsilon^{-}_{\phi}\right\rangle$.
Note that $\left|\varepsilon_{\xi}^{-}\right\rangle$ is the ground state of
$H_{\xi}\left(s\right)$, reading
$\left|\varepsilon_{\xi}^{-}\right\rangle=\cos\left(\theta_{0}s/2\right)\left|0\right\rangle+e^{i\xi}\sin\left(\theta_{0}s/2\right)\left|1\right\rangle$,
with ${\xi}\in\\{0,\phi\\}$. An equivalent form of writing
$\left|\Psi_{final}\right\rangle$ is given by

$\displaystyle\left|\Psi_{final}\right\rangle$ $\displaystyle=$
$\displaystyle\cos\left(\theta_{0}/2\right)\left(\alpha\left|\hat{n}_{+}\right\rangle+\beta\left|\hat{n}_{-}\right\rangle\right)\otimes\left|0\right\rangle$
(6)
$\displaystyle+\sin\left(\theta_{0}/2\right)\left(\alpha\left|\hat{n}_{+}\right\rangle+e^{i\phi}\beta\left|\hat{n}_{-}\right\rangle\right)\otimes\left|1\right\rangle.$

Hence, we have a probabilistic implementation of the rotated target state
$\alpha\left|\hat{n}_{+}\right\rangle+e^{i\phi}\beta\left|\hat{n}_{-}\right\rangle$
for an arbitrary angle $\phi$ around an arbitrarily chosen axis $\hat{n}$,
with probability $\sin^{2}\left(\theta_{0}/2\right)$. In particular, this
probability approximates to one by taking $\theta_{0}\approx\pi$.

In order to perform controlled rotations of a qubit by an angle $\phi$ around
a direction $\hat{n}$, the starting point will be to take the subsystem ${\cal
S}$ as a two-qubit system and keeping ${\cal A}$ as a single auxiliary qubit.
The Hamiltonian is now chosen to be

$\displaystyle H\left(s\right)$ $\displaystyle=$
$\displaystyle\left(\left|0,\hat{n}_{+}\right\rangle\left\langle
0,\hat{n}_{+}\right|+\left|0,\hat{n}_{-}\right\rangle\left\langle
0,\hat{n}_{-}\right|+\left|1,\hat{n}_{+}\right\rangle\left\langle
1,\hat{n}_{+}\right|\right)\otimes H_{0}\left(s\right)$ (7)
$\displaystyle+\left|1,\hat{n}_{-}\right\rangle\left\langle
1,\hat{n}_{-}\right|\otimes H_{\phi}\left(s\right),$

which will govern the evolution of the initial composite state
$\left|\Psi_{init}\right\rangle=\left|\psi\right\rangle\otimes|0\rangle$, with
$\left|\psi\right\rangle=\alpha\left|0,\hat{n}_{+}\right\rangle+\beta\left|0,\hat{n}_{-}\right\rangle+\gamma\left|1,\hat{n}_{+}\right\rangle+\delta\left|1,\hat{n}_{-}\right\rangle$.
From Eq. (3), the final state of the subsystem ${\cal S}$ in the limit
$\theta_{0}\rightarrow\pi$ is now the controlled rotated vector
$\left|\psi^{Rot}\right\rangle=\alpha\left|0,\hat{n}_{+}\right\rangle+\beta\left|0,\hat{n}_{-}\right\rangle+\gamma\left|1,\hat{n}_{+}\right\rangle+e^{i\phi}\delta\left|1,\hat{n}_{-}\right\rangle$.
By combining controlled rotations with the single-qubit unitaries discussed
above, it is possible to design universal sets of quantum gates through an
adiabatic implementation.

##  III Results

In this Section we present the main results of this work. We start by
generalizing the adiabatic implementation of quantum gates proposed in Ref.
Hen:15  for n-qubit controlled gates. Even though n-qubit controlled gates can
be decomposable into one and two-qubit gates (see, e.g. Refs. Barenco:95 ;
Liu:08 ), this implementation implies in an extended class of adiabatic
universal gates, e.g. the set $\\{$Toffoli , Hadamard$\\}$ Shi:03 ;
Aharonov:03  . Then, we will derive the main result of this work, which is a
shortcut for general adiabatic circuits through constant counter-diabatic
Hamiltonians, which implies in the possibility of fast analog implementations
of quantum circuits. Moreover, we will present an analysis of the quantum
speed limit in the context of the energetic cost of the superadiabatic
circuit.

###  III.1 Adiabatic $n$-controlled gates

In order to implement $n$-controlled gates, we define the subsystem ${\cal S}$
as an $(n+1)$-qubit system, with the first $n$ qubits used as the control
register and the last qubit taken as the target register. For the auxiliary
system ${\cal A}$, we keep it as a single qubit. Then, we take the initial
state as
$\left|\Psi_{init}\right\rangle=\left|\psi\right\rangle\otimes\left|0\right\rangle$,
with the subsystem ${\cal S}$ described by

$\left|\psi\right\rangle=\sum\nolimits_{k_{1},\ldots,k_{n},\epsilon}\gamma_{k_{1},\ldots,k_{n},\epsilon}\left|k_{1},\ldots,k_{n},\hat{n}_{\epsilon}\right\rangle,$
(8)

where $\gamma_{k_{1},\ldots,k_{n},\epsilon}$ are complex amplitudes,
$k_{l}\in\left\\{0,1\right\\}$, $\epsilon=\left\\{\pm\right\\}$, and $\hat{n}$
is an arbitrary axis in the Bloch sphere. Here we have written the target
qubit in the basis $\left\\{\left|\hat{n}_{\pm}\right\rangle\right\\}$,
leaving the remaining qubits of ${\cal S}$ in the computational basis. For
simplicity, we will write the states in its decimal representation, i.e.

$\sum\nolimits_{k_{1},\ldots,k_{n},\epsilon}\gamma_{k_{1},\ldots,k_{n},\epsilon}\left|k_{1},\ldots,k_{n},\hat{n}_{\epsilon}\right\rangle\rightarrow\sum_{m=0}^{N-1}\sum_{\epsilon=\pm}\gamma_{m,\epsilon}\left|m,\hat{n}_{\epsilon}\right\rangle,$

where $N=2^{n}$. Then, we let the system evolve driven by the Hamiltonian

$\displaystyle H\left(s\right)$ $\displaystyle=$
$\displaystyle\left[\sum_{n=0}^{N-2}\sum_{\epsilon=\pm}\left|n,\hat{n}_{\epsilon}\right\rangle\left\langle
n,\hat{n}_{\epsilon}\right|+\left|N-1,\hat{n}_{+}\right\rangle\left\langle
N-1,\hat{n}_{+}\right|\right]\otimes H_{0}\left(s\right)$ (9)
$\displaystyle+\left|N-1,\hat{n}_{-}\right\rangle\left\langle
N-1,\hat{n}_{-}\right|\otimes H_{\phi}\left(s\right).$

We note that the rotation of the target qubit is expected to be applied if the
state of the control system is $\left|N-1\right\rangle$. Then, if the
Hamiltonian is sufficiently slowly-varying so that we can apply the adiabatic
theorem, the system will achieve the final state

$\displaystyle\left|\Psi_{final}\right\rangle$ $\displaystyle=$
$\displaystyle\sum_{m=0}^{N-2}\sum_{\epsilon=\pm}\gamma_{m,\epsilon}\left|m,\hat{n}_{\epsilon}\right\rangle\otimes\left|\varepsilon^{-}_{0}\right\rangle+\gamma_{N-1,+}\left|N-1,\hat{n}_{+}\right\rangle\otimes\left|\varepsilon^{-}_{0}\right\rangle$
(10)
$\displaystyle+\gamma_{N-1,-}\left|N-1,\hat{n}_{-}\right\rangle\otimes\left|\varepsilon^{-}_{\phi}\right\rangle,$

where $\left|\varepsilon^{-}_{\xi}\right\rangle$ is defined as
$\left|\varepsilon^{-}_{\xi}\right\rangle=\cos\left(\theta_{0}/2\right)\left|0\right\rangle+e^{i\xi}\sin\left(\theta_{0}/2\right)\left|1\right\rangle$
($\xi\in\\{0,\phi\\}$). An equivalent form of writing Eq. (10) is

$\left|\Psi_{final}\right\rangle=\cos\left(\theta_{0}/2\right)\left|\psi\right\rangle\otimes\left|0\right\rangle+\sin\left(\theta_{0}/2\right)\left|\psi^{Rot}\right\rangle\otimes\left|1\right\rangle,$
(11)

with

$\displaystyle\left|\psi^{Rot}\right\rangle$ $\displaystyle=$
$\displaystyle\sum\nolimits_{m=0}^{N-2}\sum_{\epsilon=\pm}\gamma_{m,\epsilon}\left|m,\hat{n}_{\epsilon}\right\rangle$
(12)
$\displaystyle+\left|N-1\right\rangle\otimes\left(\gamma_{N-1,+}\left|\hat{n}_{+}\right\rangle+\gamma_{N-1,-}e^{i\phi}\left|\hat{n}_{-}\right\rangle\right).$

Thus, by performing a measurement over the auxiliary qubit, we find the
rotated state $\left|\psi^{Rot}\right\rangle$ with probability
$\sin^{2}\left(\theta_{0}/2\right)$. As in the previous case of a rotation
controlled by one qubit, this probability can be enhanced to one in the limit
$\theta_{0}\rightarrow\pi$. Indeed, this state implies in a rotation of the
target qubit in ${\cal S}$ conditioned by the state
$\left|N-1\right\rangle\equiv|1\cdots 1\rangle$ of the control register in
${\cal S}$. An application of this scheme is the adiabatic implementation of
the Toffoli gate, which constitutes an unitary operation implementing an $X$
gate over the target qubit if all control qubits are in the state $1$, with no
effect if any qubit of the control register is in the state $0$. This can be
easily achieved here by a rotation of an angle $\pi$ around of the direction
x, therefore choosing $\phi=\pi$ and
$\left|\hat{n}_{\pm}\right\rangle=\left|\pm\right\rangle$, with
$\left|\pm\right\rangle$ denoting the eigenstates of $\sigma_{x}$.

###  III.2 Shortcut to adiabaticity via counter-diabatic driving

Let us introduce now a shortcut to general CAE through the superadiabatic
approach. This will allow for fast piecewise implementation of quantum gates,
whose evolution time will not be constrained by the adiabatic theorem. We
begin by defining the evolution operator Berry:09

$U\left(t\right)=\sum_{n}e^{-\frac{i}{\hbar}\int_{0}^{t}dt^{\prime}E_{n}\left(t^{\prime}\right)}e^{-\int_{0}^{t}dt^{\prime}\left\langle
n|\partial_{t^{\prime}}n\right\rangle}\left|n(t)\right\rangle\left\langle
n(0)\right|,$ (13)

which leads an initial state $|\Psi(0)\rangle=|n(0)\rangle$ into an evolved
state $\left|\Psi\left(t\right)\right\rangle$ given by

$\left|\Psi\left(t\right)\right\rangle=e^{-\frac{i}{\hbar}\int_{0}^{t}dt^{\prime}E_{n}\left(t^{\prime}\right)}e^{-\int_{0}^{t}dt^{\prime}\left\langle
n|\partial_{t^{\prime}}n\right\rangle}\left|n(t)\right\rangle,$ (14)

where $\left|n\right\rangle=\left|n\left(t\right)\right\rangle$ are the
eigenvectors of the adiabatic Hamiltonian. Note that this evolution mimics the
adiabatic behavior. The Hamiltonian that guides the evolution of the system is
the superadiabatic Hamiltonian, which reads

$H_{SA}\left(t\right)=H\left(t\right)+H_{CD}\left(t\right),$ (15)

where the additional term $H_{CD}\left(t\right)$ is the counter-diabatic
Hamiltonian

$H_{CD}\left(t\right)=i\hbar\sum_{n}\left(\left|\partial_{t}n\right\rangle\left\langle
n\right|+\left\langle\partial_{t}n|n\right\rangle\left|n\right\rangle\left\langle
n\right|\right).$ (16)

Therefore, a superadiabatic implementation of a dynamical evolution involves
the knowledge of the eigenstates of the adiabatic Hamiltonian
$H\left(t\right)$, which limits the direct application of the superadiabatic
approach in quantum computation. For instance, by adopting the original AQC
approach Farhi:01  , superadiabatic implementations seem prohibitive, since
the whole set of eigenlevels of a many-body Hamiltonian is required. In a
similar context, counter-diabatic driving protocols based on realizable
settings have been investigated for assisted evolutions in quantum critical
phenomena Campo:12 ; Campo:13 ; Saberi:14  . Here, as we shall see, the
superadiabatic implementation of universal quantum circuits in the hybrid
approach can be promptly achieved, since we deal with the eigenspectrum of
piecewise Hamiltonians, which act over a few qubits. It is then appealing to
formulate a superadiabatic theory to CAE and then to specify it to the
implementation of universal sets of quantum gates. Let us begin by
establishing the complete set of eigenstates of the Hamiltonian
$H\left(t\right)$ provided by Eq. (2). To this end, consider the eigenvalue
equation to each Hamiltonian $H_{k}\left(t\right)$ given by

$H_{k}\left(t\right)\left|\varepsilon_{k}^{i}\left(t\right)\right\rangle=E_{k}^{i}\left(t\right)\left|\varepsilon_{k}^{i}\left(t\right)\right\rangle,$
(17)

with $i=1,\cdots,d_{\cal A}$. By defining the projectors $P_{k}$ in Eq. (2) as
$P_{k}=\left|\lambda_{k}\right\rangle\left\langle\lambda_{k}\right|$, with
$\left\langle\lambda_{k}|\lambda_{k^{\prime}}\right\rangle=\delta_{kk^{\prime}}$
and $k=1,\cdots,d_{\cal S}$, we can write the complete set of eigenstates of
$H\left(t\right)$ as

$\left|\gamma^{i}_{l}\left(t\right)\right\rangle=\left|\lambda_{l}\right\rangle\otimes\left|\varepsilon_{l}^{i}\left(t\right)\right\rangle,$
(18)

such that
$H\left(t\right)\left|\gamma^{i}_{l}\left(t\right)\right\rangle=E_{l}^{i}\left(t\right)\left|\gamma^{i}_{l}\left(t\right)\right\rangle$.
Indeed, from Eq. (2), we have
$H\left(t\right)\left|\gamma^{i}_{l}\left(t\right)\right\rangle=\left[\sum\nolimits_{k}P_{k}\otimes
H_{k}\left(t\right)\right]\left[\left|\lambda_{l}\right\rangle\otimes\left|\varepsilon_{l}^{i}\left(t\right)\right\rangle\right]=E_{l}^{i}\left(t\right)\left|\gamma^{i}_{l}\left(t\right)\right\rangle$.
Note that each projector $P_{k}$ is associated with a Hamiltonian $H_{k}$. For
instance, for the adiabatic implementation of $n$-controlled gates, we have
defined the Hamiltonian $H$ in Eq. (9) by linking the set
$\\{|m,n_{\pm}\rangle\langle
m,n_{\pm}|\,(m=0,\cdots,N-2),\,\,|N-1,n_{+}\rangle\langle N-1,n_{+}|\\}$ with
$H_{0}$ and by linking the remaining projector $|N-1,n_{-}\rangle\langle
N-1,n_{-}|$ with $H_{\phi}$. The next step is to obtain the counter-diabatic
Hamiltonian $H_{CD}\left(t\right)$ that implements the shortcut to the
adiabatic evolution of $H\left(t\right)$. In this direction, we use the
eigenstates of $H\left(t\right)$ as given by Eq. (18). Then, we get

$H_{CD}\left(t\right)=i\hbar\sum\nolimits_{i}\sum\nolimits_{l}\left[\left|\partial_{t}\gamma^{i}_{l}\right\rangle\left\langle\gamma^{i}_{l}\right|+\left\langle\partial_{t}\gamma^{i}_{l}\,\,\left|\frac{}{}\right.\gamma^{i}_{l}\right\rangle\left|\gamma^{i}_{l}\right\rangle\left\langle\gamma^{i}_{l}\right|\right],$
(19)

with
$\left|\gamma^{i}_{l}\right\rangle\equiv\left|\gamma^{i}_{l}\left(t\right)\right\rangle$.
Therefore

$\displaystyle H_{CD}\left(t\right)$ $\displaystyle=$ $\displaystyle
i\hbar\sum_{l}\left[|\lambda_{l}\rangle\langle\lambda_{l}|\otimes\sum_{i}\left(\left|\partial_{t}\varepsilon^{i}_{l}\right\rangle\left\langle\varepsilon^{i}_{l}\right|+\left\langle\partial_{t}\varepsilon^{i}_{l}\,\,\left|\frac{}{}\right.\varepsilon^{i}_{l}\right\rangle\left|\varepsilon^{i}_{l}\right\rangle\left\langle\varepsilon^{i}_{l}\right|\right)\right]$
(20) $\displaystyle=$ $\displaystyle\sum\nolimits_{l}\left[P_{l}\otimes
H_{l}^{CD}\left(t\right)\right],$

where
$\left|\varepsilon^{i}_{l}\right\rangle\equiv\left|\varepsilon^{i}_{l}\left(t\right)\right\rangle$
and $H_{l}^{CD}$ is the counter-diabatic Hamiltonian to be associated with the
piecewise adiabatic contribution $H_{l}\left(t\right)$ acting over subsystem
${\cal A}$, which reads

$H_{l}^{CD}\left(t\right)=i\hbar\sum\nolimits_{i}\left[\left|\partial_{t}\varepsilon^{i}_{l}\right\rangle\left\langle\varepsilon^{i}_{l}\right|+\left\langle\partial_{t}\varepsilon^{i}_{l}\,\,\left|\frac{}{}\right.\varepsilon^{i}_{l}\right\rangle\left|\varepsilon^{i}_{l}\right\rangle\left\langle\varepsilon^{i}_{l}\right|\right].$
(21)

Hence, from Eq. (15), we can implement the shortcut dynamics through the
superadiabatic Hamiltonian

$H_{SA}\left(t\right)=\sum\nolimits_{k}P_{k}\otimes H_{k}^{SA}\left(t\right),$
(22)

where $H_{k}^{SA}\left(t\right)\equiv
H_{k}\left(t\right)+H_{k}^{CD}\left(t\right)$ is the piecewise superadiabatic
Hamiltonian. Note that the cost of performing superadiabatic evolutions
requires the knowledge of the eigenvalues and eigenstates of
$H_{l}\left(t\right)$. For the implementation of general $n$-controlled gates,
this is a Hamiltonian acting over a single qubit, which is independent of the
circuit complexity. Moreover, we can show that, for an arbitrary
$n$-controlled quantum gate, the counter-diabatic Hamiltonians $H_{\xi}^{CD}$
(${\xi}\in\\{0,\phi\\}$) associated with shortcuts to adiabatic evolutions
driven by
$H_{\xi}\left(s\right)=-\omega\hbar\left\\{\sigma_{z}\cos(\theta_{0}s)+\sin(\theta_{0}s)\left[\sigma_{x}\cos\xi+\sigma_{y}\sin\xi\right]\right\\}$,
with $s=t/\tau$, are time-independent operators given by

$H_{\xi}^{CD}=\hbar\frac{\theta_{0}}{2\tau}\left[\sigma_{y}\cos\xi-\sigma_{x}\sin\xi\right].$
(23)

Eq. (23) shows that the implementation of the shortcut can be achieved with a
very simple assistant Hamiltonian in the quantum dynamics. Its proof is
provided in Section Methods.

###  III.3 Quantum speed limit

It is expected that the shortcut via a counter-diabatic Hamiltonian is faster
than the evolution via an adiabatic Hamiltonian, but how much faster can it
be? To answer this question, we shall take a lower bound to the time evolution
in quantum dynamics as provided by the quantum speed limit (QSL). We will
consider a closed quantum system evolving between arbitrary pure states
$\left|\Psi\left({0}\right)\right\rangle$ and
$\left|\Psi\left(\tau\right)\right\rangle$. Since the evolution is driven by a
time-dependent superadiabatic Hamiltonian $H_{SA}(t)$, we will take the
generalized Margolus-Levitin bound Margolus:98  derived by Deffner and Lutz
Deffner:13  , which reads

$\tau\geq\hbar\frac{\left|\cos\mathcal{L}\left(\Psi\left(0\right),\Psi\left(\tau\right)\right)-1\right|}{E_{\tau}},$
(24)

where
$\mathcal{L}\left(\Psi\left(0\right),\Psi\left(\tau\right)\right)=\arccos\left[\left|\left\langle\Psi_{0}|\Psi\left(\tau\right)\right\rangle\right|\right]$
is the Bures metric for pure states Nielsen:book  and

$E_{\tau}=\frac{1}{\tau}\int_{0}^{\tau}dt\left|\left\langle\Psi(0)|H_{SA}\left(t\right)|\Psi\left(t\right)\right\rangle\right|.$
(25)

For superadiabatic evolutions, the initial state
$\left|\Psi\left(0\right)\right\rangle=|\gamma_{0}(0)\rangle$ evolves to
$\left|\Psi\left(t\right)\right\rangle=|\gamma_{0}(t)\rangle$, where
$|\gamma_{0}(t)\rangle$ denotes the instantaneous ground state of the
adiabatic Hamiltonian $H(t)$. By using the parametrized time $s=t/\tau$, we
can show from Eqs. (24) and (25) that the total time $\tau$ that mimics the
adiabatic evolution within the superadiabatic approach can be reduced to an
arbitrary small value. More specifically, the addition of a counter-diabatic
Hamiltonian implies into the QSL bound

$\eta\,\tau\omega+\chi\,\geq\,\hbar\left|\cos\mathcal{L}\left(\Psi\left(0\right),\Psi\left(\tau\right)\right)-1\right|,$
(26)

with $\eta>0$ and
$\chi\geq\hbar\left|\cos\mathcal{L}\left(\Psi\left(0\right),\Psi\left(\tau\right)\right)-1\right|$,
as shown in Section Methods. Therefore, the QSL bound reduces to

$\tau\omega\geq 0\hskip
14.22636pt(\,\,\forall\,\,\,\left|\Psi\left(0\right)\right\rangle\,\,\,,\,\,\,\left|\Psi\left(\tau\right)\right\rangle\,\,),$
(27)

with $\tau$ and $\omega$ defined by the superadiabatic Hamiltonian
$H_{SA}(t)$. This means that the superadiabatic implementation is compatible
with an arbitrary reduction of the total time $\tau$, which holds
independently of the boundary states $\left|\Psi\left(0\right)\right\rangle$
and $\left|\Psi\left(\tau\right)\right\rangle$. Naturally, a higher energetic
cost is expected to be involved for a smaller evolution time $\tau$. In
particular, saturation of Eq. (27) is achieved for either $\tau\rightarrow 0$
or $\omega\rightarrow 0$, with both cases implying in $\tau\omega\rightarrow
0$. Note that this limit is forbidden in the adiabatic regime for finite
$\omega$, since the energy gap is proportional to $\hbar\omega$, which implies
in an adiabatic time of the order $\tau_{ad}\propto 1/\omega^{n}$, with
$n\in\mathbb{N}^{+}$ Messiah:book ; Teufel:03 ; Jansen:07 ; Sarandy:04  .
Hence, Eq. (27) leads to a flexible running time in a superadiabatic
implementation, only limited by the energy-time complementarity.

###  III.4 The Energetic Cost

Let us show now that time and energy are complementary resources in
superadiabatic implementations of quantum evolutions. We shall define the
energetic cost associated with a superadiabatic Hamiltonian through

$\Sigma\left(\tau\right)=\frac{1}{\tau}\int_{0}^{\tau}\left\|{H}_{SA}\left(t\right)\right\|dt,$
(28)

with ${H}_{SA}\left(t\right)$ given by Eq. (22) and the norm provided by the
Hilbert-Schmidt norm $\left\|A\right\|=\sqrt{Tr\left[A^{{\dagger}}A\right]}$.
Since ${H}_{SA}\left(t\right)$ is Hermitian, we can write

$\displaystyle\Sigma\left(\tau\right)$ $\displaystyle=$
$\displaystyle\frac{1}{\tau}\int_{0}^{\tau}\sqrt{\text{Tr}\left[{H}_{SA}^{2}\left(t\right)\right]}dt$
(29) $\displaystyle=$
$\displaystyle\frac{1}{\tau}\int_{0}^{\tau}\sqrt{\text{Tr}\left[{H}^{2}\left(t\right)+{H}_{CD}^{2}\left(t\right)\right]}dt.$

To derive Eq. (29), we have used that
${\textrm{Tr}}\left(\left\\{H(t),\frac{}{}H_{CD}(t)\right\\}\right)=0$. This
can be obtained by computing the trace in the eigenbasis of $H(t)$ and
noticing that the expectation value of $H_{CD}(t)$ taken in an eigenstate of
$H(t)$ vanishes, i.e.
$\left\langle\gamma_{l}^{i}(t)\right|H_{CD}(t)\left|\gamma_{l}^{i}(t)\right\rangle=0$.
In particular, let us define the energetic cost to the adiabatic Hamiltonian
as

$\Sigma_{0}\left(\tau\right)=\frac{1}{\tau}\int_{0}^{\tau}\sqrt{Tr\left[{H}^{2}\left(t\right)\right]}dt.$

Then, it follows that the energetic cost $\Sigma\left(\tau\right)$ in
superadiabatic evolutions supersedes the energetic cost
$\Sigma_{0}\left(\tau\right)$ for a corresponding adiabatic physical process.
In order to evaluate $\Sigma\left(\tau\right)$ we adopt the basis of
eigenstates of the adiabatic Hamiltonian ${H}\left(t\right)$. By using Eq.
(18), this yields

$\Sigma\left(\tau\right)=\frac{1}{\tau}\int_{0}^{\tau}\sqrt{\sum\nolimits_{l=1}^{d_{{\cal
S}}}\sum\nolimits_{m=1}^{d_{{\cal
A}}}\left[E_{l}^{m}\left(t\right)^{2}+\hbar^{2}\mu_{l}^{m}\left(t\right)\right]}dt,$
(30)

where $E_{l}^{m}\left(t\right)$ are the energies of the adiabatic Hamiltonian
$H_{l}\left(t\right)$ and

$\mu_{l}^{m}\left(t\right)=\left\langle\partial_{t}{\gamma}_{l}^{m}\left(t\right)|\partial_{t}{\gamma}_{l}^{m}\left(t\right)\right\rangle-\left|\left\langle\gamma_{l}^{m}\left(t\right)|\partial_{t}{\gamma}_{l}^{m}\left(t\right)\right\rangle\right|^{2}.$
(31)

In order to analyze the energetic cost as provided by Eq. (30) for
superadiabatic qubit rotation gates, we set $d_{{\cal S}}=d_{{\cal A}}=2$ and
$E_{l}^{m}\left(s\right)=\left(-1\right)^{m+1}\hbar\omega$ $(\forall l)$.
Moreover, by using Eq. (18), we obtain
$\mu_{l}^{m}\left(t\right)=\left\langle\partial_{t}{\varepsilon}_{l}^{m}\left(t\right)|\partial_{t}{\varepsilon}_{l}^{m}\left(t\right)\right\rangle-\left|\left\langle\varepsilon_{l}^{m}\left(t\right)|\partial_{t}{\varepsilon}_{l}^{m}\left(t\right)\right\rangle\right|^{2}$,
which leads to $\mu_{l}^{m}\left(s\right)=\theta_{0}^{2}/4\tau^{2}$ [See Eqs.
(34) and (35) in Section Methods]. Hence

$\Sigma\left(\tau\right)=2\sqrt{1+\frac{\theta_{0}^{2}}{4\left(\tau\omega\right)^{2}}}\hbar\omega.$
(32)

Figure 1: Energetic cost in unities of $\hbar\omega$ as a function of
$\omega\tau$ for different values of $\theta_{0}$.

We illustrate the behavior of $\Sigma\left(\tau\right)$ in Fig. 1, where it is
apparent that the energetic cost increases inversely proportional to the total
time of evolution. In particular, note also that, for a fixed energetic cost,
the optimal choice $\ \theta_{0}\rightarrow\pi$ requires a longer evolution.
This is because of the fact that, in this case, the final state associated
with the auxiliary qubit is orthogonal to its initial state, so it is farther
in the Bloch sphere. In the more general case of controlled gates, the
analysis is similar as in the case of single-qubit gates. However, we must
take into account the number of projectors composing the set $\\{P_{k}\\}$.
More specifically, the sum over $l$ in Eq. (30) shall run over $1$ to $4$,
which is the number of projectors over the subsystem ${\cal S}$. Thus we can
show that energetic cost $\Sigma^{CG}$ to implement controlled gates is
$\Sigma^{CG}=\sqrt{2}\Sigma$.

##  IV Methods

###  IV.1 Time-independent counter-diabatic Hamiltonians for $n$-controlled
gates

Let us explicitly design here the superadiabatic implementation of controlled
evolutions for piecewise Hamiltonians $H_{\xi}(s)$ as provided by Eqs.
(LABEL:pw-H). To this end, consider the eigenvalue equation

$H_{\xi}\left(s\right)\left|\varepsilon_{\xi}^{i}\left(s\right)\right\rangle=E_{\xi}^{i}\left(s\right)\left|\varepsilon_{\xi}^{i}\left(s\right)\right\rangle,$
(33)

with $\xi=\left\\{0,\phi\right\\}$, where

$\displaystyle\left|\varepsilon_{\xi}^{+}\left(s\right)\right\rangle$
$\displaystyle=$
$\displaystyle-\sin\frac{\theta_{0}s}{2}\left|0\right\rangle+e^{i\xi}\cos\frac{\theta_{0}s}{2}\left|1\right\rangle,$
(34) $\displaystyle\left|\varepsilon_{\xi}^{-}\left(s\right)\right\rangle$
$\displaystyle=$
$\displaystyle\cos\frac{\theta_{0}s}{2}\left|0\right\rangle+e^{i\xi}\sin\frac{\theta_{0}s}{2}\left|1\right\rangle.$
(35)

From Eq. (18), it follows that the eigenstates for the adiabatic Hamiltonian
$H\left(s\right)$ governing the composite system ${\cal{SA}}$ are given by the
sets
$\left\\{\left|\gamma^{i}_{0}\left(s\right)\right\rangle=\left|\hat{n}_{+}\right\rangle\otimes\left|\varepsilon_{0}^{i}\left(s\right)\right\rangle\right\\}$
and
$\left\\{\left|\gamma^{i}_{\phi}\left(s\right)\right\rangle=\left|\hat{n}_{-}\right\rangle\otimes\left|\varepsilon_{\phi}^{i}\left(s\right)\right\rangle\right\\}$
associated with the set of eigenvalues
$\left\\{E^{i}_{0}\left(s\right)\right\\}$ and
$\left\\{E^{i}_{\phi}\left(s\right)\right\\}$, respectively. By evaluating the
eigenvalues of $H_{0}\left(s\right)$ and $H_{\phi}\left(s\right)$, we obtain
that their spectra are equal, being provided by
$E_{0}^{\pm}=E_{\phi}^{\pm}=\pm\omega\hbar$. Thus, $H\left(s\right)$ exhibits
doubly degenerate levels, with
$\left\\{\left|\gamma^{+}_{0}\left(s\right)\right\rangle,\left|\gamma^{+}_{\phi}\left(s\right)\right\rangle\right\\}$
and
$\left\\{\left|\gamma^{-}_{0}\left(s\right)\right\rangle,\left|\gamma^{-}_{\phi}\left(s\right)\right\rangle\right\\}$
associated with levels $E^{+}=\omega\hbar$ and $E^{-}=-\omega\hbar$,
respectively. By using now Eqs. (34) and (35), we obtain
$\left\langle\partial_{t}\varepsilon^{i}_{l}\,\,\left|\frac{}{}\right.\varepsilon^{i}_{l}\right\rangle=0$,
for any $i=\left\\{\pm\right\\}$ and $\xi=\left\\{0,\phi\right\\}$. Then, from
Eq. (20), we obtain that the counter-diabatic hamiltonian is
$H_{\xi}^{CD}\left(s\right)=i\hbar\sum\nolimits_{i=\left\\{\pm\right\\}}\left|\partial_{t}\varepsilon_{\xi}^{i}\left(s\right)\right\rangle\left\langle\varepsilon_{\xi}^{i}\left(s\right)\right|$,
which leads to the time-independent counter-diabatic Hamiltonian given by Eq.
(23). The extension to the case of $n$-controlled gates can be achieved as
follows. From Eq. (18), the eigenstates of $H\left(s\right)$ read

$\displaystyle\left|\gamma_{0m}^{\epsilon k}\left(s\right)\right\rangle$
$\displaystyle=$
$\displaystyle\left|m,\hat{n}_{\epsilon}\right\rangle\otimes\left|\varepsilon_{0}^{k}\left(s\right)\right\rangle,$
$\displaystyle\left|\gamma_{0\,(N-1)}^{+k}\left(s\right)\right\rangle$
$\displaystyle=$
$\displaystyle\left|N-1,\hat{n}_{+}\right\rangle\otimes\left|\varepsilon_{0}^{k}\left(s\right)\right\rangle,$
$\displaystyle\left|\gamma_{\phi\,(N-1)}^{-k}\left(s\right)\right\rangle$
$\displaystyle=$
$\displaystyle\left|N-1,\hat{n}_{-}\right\rangle\otimes\left|\varepsilon_{\phi}^{k}\left(s\right)\right\rangle,$

where $m=\left\\{0,\cdots,N-2\right\\}$, $\epsilon,k=\left\\{\pm\right\\}$ and
$\xi=\left\\{0,\phi\right\\}$. By computing the eigenvalues of
$H\left(s\right)$, we obtain that the spectrum of $H\left(s\right)$ is
$\left(2N\right)$-degenerate, with
$\left\\{\left|\gamma_{0m}^{\epsilon+}\left(s\right)\right\rangle,\left|\gamma_{0\,(N-1)}^{++}\left(s\right)\right\rangle,\left|\gamma_{\phi\,(N-1)}^{-+}\left(s\right)\right\rangle\right\\}$
and
$\left\\{\left|\gamma_{0m}^{\epsilon-}\left(s\right)\right\rangle,\left|\gamma_{0\,(N-1)}^{+-}\left(s\right)\right\rangle,\left|\gamma_{\phi\,(N-1)}^{--}\left(s\right)\right\rangle\right\\}$
associated with the levels $E^{+}=\omega\hbar$ and $E^{-}=-\omega\hbar$,
respectively. By using these results into Eq. (20), we obtain that the
counter-diabatic piecewise Hamiltonian $H_{\xi}^{CD}\left(s\right)$ is given
by Eq. (23). Hence, the implementation any $n$-controlled gate is achieved
through a time-independent counter-diabatic Hamiltonian.

###  IV.2 Quantum speed limit for superadiabatic evolutions

Let us apply here the QSL bound to superadiabatic evolutions. By using the
fact than the $\left|\Psi\left(t\right)\right\rangle$ evolves in the ground
state $\left|\gamma_{0}\left(t\right)\right\rangle$ of $H\left(t\right)$ and
that $H_{SA}\left(t\right)$ is given by Eq. (15), we have

$\displaystyle E_{\tau}$ $\displaystyle=$
$\displaystyle\frac{1}{\tau}\int_{0}^{\tau}dt\left|\left\langle\gamma_{0}\left(0\right)|H_{SA}\left(t\right)|\gamma_{0}\left(t\right)\right\rangle\right|,$
$\displaystyle=$
$\displaystyle\frac{1}{\tau}\int_{0}^{\tau}dt\left|E_{0}\left(t\right)\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(t\right)\right\rangle+\left\langle\gamma_{0}\left(0\right)|H_{CD}\left(t\right)|\gamma_{0}\left(t\right)\right\rangle\right|,$

where $E_{0}(t)$ is the instantaneous ground state energy of $H(t)$. Now we
use Eq. (16) and the inequality
$\int_{0}^{\tau}dt\left|f\left(t\right)+g\left(x\right)\right|\leq\int_{0}^{\tau}dt\left|f\left(t\right)\right|+\int_{0}^{\tau}dt\left|g\left(t\right)\right|$,
which yields

$\displaystyle E_{\tau}$ $\displaystyle\leq$
$\displaystyle\frac{1}{\tau}\int_{0}^{\tau}dt\left|E_{0}\left(t\right)\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(t\right)\right\rangle\right|+\frac{\hbar}{\tau}\int_{0}^{\tau}dt\left|\left\langle\gamma_{0}\left(0\right)|\partial_{t}{\gamma}_{0}\left(t\right)\right\rangle\right|$
(36)
$\displaystyle+\frac{\hbar}{\tau}\int_{0}^{\tau}dt\left|\left\langle\gamma_{0}\left(t\right)|\partial_{t}{\gamma}_{0}\left(t\right)\right\rangle\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(t\right)\right\rangle\right|.$

By using the parametrized time $s=t/\tau$, we obtain

$E_{\tau}\leq\eta_{1}(s)+\frac{\left(\eta_{2}(s)+\eta_{3}(s)\right)}{\tau},$

where the parameters $\eta_{i}(s)$ ($i=1,2,3$) are given by
$\eta_{1}(s)=\int_{0}^{1}ds\left|E_{0}\left(s\right)\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right|,$
$\eta_{2}(s)=\hbar\int_{0}^{1}ds\left|\left\langle\gamma_{0}\left(0\right)|\partial_{s}\gamma_{0}\left(s\right)\right\rangle\right|$
and
$\eta_{3}(s)=\hbar\int_{0}^{1}ds\left|\left\langle\gamma_{0}\left(s\right)|\partial_{s}\gamma_{0}\left(s\right)\right\rangle\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right|$.
Since the ground state energy for the adiabatic Hamiltonian $H(s)$ in the case
of $n$-controlled gates is $E_{0}(s)=-\omega\hbar$ [see Eqs. (LABEL:pw-H) and
(9)], we write $\eta_{1}(s)=\omega\eta(s)$, with
$\eta(s)=\hbar\int_{0}^{1}ds\left|\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right|$.
Moreover, we define $\chi(s)\equiv\eta_{2}(s)+\eta_{3}(s)$. Then

$\eta(s)\,\omega\tau+\chi(s)\geq\hbar\left|\cos\mathcal{L}\left(\gamma_{0}\left(0\right),\gamma_{0}\left(1\right)\right)-1\right|.$
(37)

Let us now analise the term $\chi(s)$. First, note that
$\left\langle\gamma_{0}\left(0\right)|\partial_{s}\gamma_{0}\left(s\right)\right\rangle=d_{s}\left(\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right)$.
Then, we use that
$\left|d_{s}\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right|\geq\left|d_{s}\left|\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right|\right|$
(see proof in Ref. Deffner:13 ), which yields

$\displaystyle\chi(s)$ $\displaystyle\geq$
$\displaystyle\eta_{2}(s)\geq\hbar\int_{0}^{1}ds\left|d_{s}\left|\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right|\frac{}{}\right|$
(38) $\displaystyle\geq$
$\displaystyle\hbar\left|\int_{0}^{1}ds\left(d_{s}\left|\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(s\right)\right\rangle\right|\right)\right|$
$\displaystyle=$
$\displaystyle\hbar\left|\left|\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(1\right)\right\rangle\right|-1\right|,$

where we have used the inequality
$\int_{0}^{\tau}dt\left|f\left(t\right)\right|\geq\left|\int_{0}^{\tau}dtf\left(t\right)\right|$.
From the definition of the Bures metric, we have
$\left|\left\langle\gamma_{0}\left(0\right)|\gamma_{0}\left(1\right)\right\rangle\right|=\cos\mathcal{L}\left(\gamma_{0}\left(0\right),\gamma_{0}\left(1\right)\right)$.
Hence,
$\chi(s)\geq\hbar\left|\cos\mathcal{L}\left(\psi\left(0\right),\psi\left(\tau\right)\right)-1\right|$,
which implies into Eq. (27).

##  V Discussion and conclusion

We have proposed a scheme for implementing universal sets of quantum gates
within the superadiabatic approach. In particular, we have shown that this can
be achieved by applying a time-independent counter-diabatic Hamiltonian in the
auxiliary qubit to induce fast controlled evolutions. Remarkably, this
Hamiltonian is universal, holding both for performing single-qubit and
$n$-controlled qubit gates. Therefore, a shortcut to the adiabatic
implementation of quantum gates can be achieved through a rather simple
mechanism. In particular, different sets of universal quantum gates can be
designed by using essentially the same counter-diabatic Hamiltonian. Moreover,
we have shown that the flexibility of the evolution time in a superadiabatic
dynamics can be directly traced back from the QSL bound. In this context, the
running time is only constrained by the energetic cost of the superadiabatic
implementation, within a time-energy complementarity relationship.
Implications of the superadiabatic approach under decoherence and a fault-
tolerance analysis of superadiabatic circuits are further challenges of
immediate interest. In a quantum open-systems scenario, there is a compromise
between the time required by adiabaticity and the decoherence time of the
quantum device. Therefore, the superadiabatic implementation may provide a
direction to obtain an optimal running time for the quantum algorithm while
keeping an inherent protection against decoherence. In turn, a basis for such
development may be provided by the generalization of the superadiabatic theory
for the context of open systems Jing:13 ; Vacanti:14 ; Jing:15 ; Shi:14  .
Concerning error-protection, it may also be fruitful the comparison of our
approach with non-adiabatic holonomic quantum computation, where non-adiabatic
geometric phases are used to perform universal quantum gates (see, e.g. recent
proposals in Refs. Feng:13 ; Xu:14  ). Moreover, the behavior of correlations
such as entanglement may also be an additional relevant resource for
superadiabaticity applied to quantum computation. These investigations as well
as experimental proposals for superadiabatic circuits are left for future
research.

## Acknowledgements

We are grateful to Itay Hen and Adolfo del Campo for useful discussions. M. S.
S. thanks Daniel Lidar for his hospitality at the University of Southern
California. We acknowledge financial support from the Brazilian agencies CNPq,
CAPES, and FAPERJ. This work has been performed as part of the Brazilian
National Institute of Science and Technology for Quantum Information (INCT-
IQ).

## References

  * (1) Born, M. & Fock V. Beweis des adiabatensatzes. Z. Phys. 51, 165 (1928).
  * (2) Kato T. On the adiabatic theorem of quantum mechanics. J. Phys. Soc. Jpn. 5, 435 (1950).
  * (3) Messiah A. Quantum mechanics. North-Holland, Amsterdam (1962).
  * (4) Teufel, S. Adiabatic perturbation theory in quantum dynamics. Lecture Notes in Mathematics 1821, SpringerVerlag, Berlin, Heidelberg, New York (2003), 2003.
  * (5) Ambainis A. & Regev O. An elementary proof of the quantum adiabatic theorem. arXiv:quant-ph/0411152 (2004).
  * (6) Tong D. M., Singh K., Kwek L. C. & Oh C. H. Quantitative conditions do not guarantee the validity of the adiabatic approximation. Phys. Rev. Lett. 95, 110407 (2005).
  * (7) Jansen, S., Ruskai, M.-B., & Seiler, R. Bounds for the adiabatic approximation with applications to quantum computation. J. Math. Phys. 48, 102111 (2007).
  * (8) Amin M. H. S. Consistency of the adiabatic theorem Phys. Rev. Lett., 102, 220401 (2009).
  * (9) Tong, D. M. Quantitative condition is necessary in guaranteeing the validity of the adiabatic approximation. Phys. Rev. Lett. 104, 120401 (2010).
  * (10) Cao H., Guo Z., Chen Z. & Wang W. Quantitative sufficient conditions for adiabatic approximation. Sci China - Phys. Mech. Astron., 56, 1401 (2013).
  * (11) Tong D. M., Singh K., Kwek L. C. & Oh C. H. Sufficiency criterion for the validity of the adiabatic approximation. Phys. Rev. Lett. 98, 150402 (2007).
  * (12) Yu B., Cao H., Guo Z. & Wang W. Computable upper bounds for the adiabatic approximation errors. Sci China - Phys. Mech. Astron., 57, 2031 (2014).
  * (13) Wang W., Cao H., Lu L. & Yu B. An upper bound for the generalized adiabatic approximation error with a superposition initial state. Sci China - Phys. Mech. Astron., 58, 030001 (2015).
  * (14) Farhi, E., Goldstone, J., Gutmann, S., Lapan, J., Lundgren, A. & Preda, D. A quantum adiabatic evolution algorithm applied to random instances of an NP-complete problem. Science 292, 472 (2001).
  * (15) Aharonov, D., van Dam, W., Kempe, J., Landau, Z., Lloyd, S. & Regev, O. Adiabatic quantum computation is equivalent to standard quantum computation. SIAM Journal of Computing 37, 166 (2007).
  * (16) Steffen, M., van Dam, W., Hogg, T., Breyta, G. & Chuang, I. Experimental implementation of an adiabatic quantum optimization algorithm. Phys. Rev. Lett. 90, 067903 (2003).
  * (17) Peng, X., Liao, Z., Xu, N., Qin, G., Zhou, X., Suter, D. & Du, J. Quantum adiabatic algorithm for factorization and its experimental implementation. Phys. Rev. Lett. 101, 220405 (2008).
  * (18) Long Y., Feng G., Tang Y., Qin W. & Long G. NMR realization of adiabatic quantum algorithms for the modified Simon problem. Phys. Rev. A 88, 012306 (2013).
  * (19) Richerme, P., Senko, C., Smith, J., Lee, A., Korenblit, S. & Monroe, C. Experimental performance of a quantum simulator: optimizing adiabatic evolution and identifying many-body ground states. Phys. Rev. A 88, 012334 (2013).
  * (20) Johnson M. W. et al. Quantum annealing with manufactured spins. Nature 473, 194 (2011).
  * (21) Boixo, S., Albash, T., Spedalieri, F. M., Chancellor, N. & Lidar, D. A. Experimental signature of programmable quantum annealing. Nature Comm. 4, 3067 (2013).
  * (22) Boixo, S., Ronnow, T., Isakov, S., Wang, Z., Wecker, D., Lidar, D. A., Martinis, J. & Troyer, M. Evidence for quantum annealing with more than one hundred qubits. Nature Physics 10, 218 (2014).
  * (23) Bacon D. & Flammia, S. T. Adiabatic gate teleportation. Phys. Rev. Lett. 103, 120504 (2009).
  * (24) Hen, I. Quantum gates with controlled adiabatic evolutions. Phys Rev A 91, 022309 (2015).
  * (25) Barenco A., Bennett C. H., Cleve R., DiVincenzo D. P., Margolus N., Shor P., Sleator T., Smolin J. A. & Weinfurter H. Elementary gates for quantum computation. Phys. Rev. A 52, 3457 (1995).
  * (26) Nielsen, M. A. & Chuang, I. L. Quantum computation and quantum information. Cambridge University Press, Cambridge (2000).
  * (27) Martinis J. M. & Geller M. R. Fast adiabatic qubit gates using only $\sigma_{z}$ control. Phys. Rev. A 90, 022307 (2014).
  * (28) Demirplak M. & Rice S. A. Adiabatic population transfer with control fields. J. Phys. Chem. A 107, 9937 (2003).
  * (29) Demirplak M. & Rice S. A. Assisted adiabatic passage revisited. J. Phys. Chem. B 109, 6838 (2005).
  * (30) Berry, M. V. Transitionless quantum driving. J. Phys. A: Math. Theor. 42, 365303 (2009).
  * (31) Torrontegui, E., Ibanez, S., Martinez-Garaot, M., Modugno, M., del Campo, A., Guery-Odelin, D., Ruschhaupt, A., Chen, X. & Muga, J. G. Shortcuts to adiabaticity Adv. Atom. Mol. Opt. Phys. 62, 117 (2013).
  * (32) Mandelstam, L. & Tamm, I. G. The uncertainty relation between energy and time in non-relativistic quantum mechanics. J. Phys. (Moscow) 9, 249 (1945).
  * (33) Margolus, N. & Levitin, L. B. The maximum speed of dynamical evolution. Physica D 120, 188 (1998).
  * (34) Giovannetti, V., Lloyd, S., & Maccone, L. Quantum limits to dynamical evolution Phys. Rev. A 67, 052109 (2003)
  * (35) Deffner, S. & Lutz, E. Energy-time uncertainty relation for driven quantum systems. J. Phys. A: Math. Theor. 46, 335302 (2013).
  * (36) Liu Y., Long G. L. & Sun Y. Analytic one-bit and CNOT gate constructions of general n-qubit controlled gates. Int. J. Quantum Inform. 6, 447 (2008).
  * (37) Shi Y. Y. Both Toffoli and Controlled-NOT need little help to do universal quantum computation. Quantum Inf. Comp. 3, 84 (2003).
  * (38) Aharonov, D. A simple proof that Toffoli and Hadamard are quantum universal. arXiv:quant-ph/0301040 (2003).
  * (39) del Campo A., Rams M. M. & Zurek W. H. Assisted finite-rate adiabatic passage across a quantum critical point: exact solution for the quantum Ising model. Phys. Rev. Lett. 109, 115703 (2012).
  * (40) del Campo A. Shortcuts to adiabaticity by counter-diabatic driving. Phys. Rev. Lett. 111, 100502 (2013).
  * (41) Saberi H., Opatrny T., Molmer K. & del Campo A. Adiabatic tracking of quantum many-body dynamics. Phys. Rev. A 90, 060301(R) (2014).
  * (42) Sarandy, M. S., Wu, L.-A., & Lidar, D. Consistency of the adiabatic theorem Quantum Inf. Process. 3, 331 (2004).
  * (43) Jing, J., Wu, L.-A., Sarandy, M. S. & Muga, J. G. Inverse engineering control in open quantum systems. Phys. Rev. A 88, 053422 (2013).
  * (44) Vacanti, G., Fazio, R., Montangero, S., Palma, G. M., Paternostro M. & Vedral V. Transitionless quantum driving in open quantum systems. New J. Phys. 16, 053017 (2014).
  * (45) Jing J. & Wu L.-A. Overview of quantum memory protection and adiabaticity induction by fast-signal control. Science Bull. 60, 328 (2015).
  * (46) Shi X., Wei L. & Oh C. H. Quantum computation with surface-state electrons by rapid population passages. Sci China - Phys. Mech. Astron., 57, 1718 (2014).
  * (47) Feng G., Xu G. & Long G. Experimental realization of nonadiabatic holonomic quantum computation. Phys. Rev. Lett. 110, 190501 (2013).
  * (48) Xu G. & Long G. Universal nonadiabatic geometric gates in two-qubit decoherence-free subspaces. Sci. Rep. 4, 6814 (2014).


# Engineering and Experimentally Benchmarking Open Source MQTT Broker
Implementations

Jasenka Dizdarević, Marc Michalke and Admela Jukan  Technische Universität
Braunschweig
Braunschweig, Germany
{j.dizdarevic, m.michalke<EMAIL_ADDRESS>
###### Abstract

The Message Queuing Telemetry Transport (MQTT) protocol is one of the most
widely used IoT protocol solutions. In this work, we are especially interested
in open-source MQTT Broker implementations (such as Mosquitto, EMQX, RabbitMQ,
VerneMQ, and HiveMQ) and their performance in edge networks with various the
parameters of network delay, variance and packet loss. To this end, we
engineer a network testbed to experimentally benchmark the performance of
these implementations in an edge computing context with constrained devices.
In more detail, we engineer an automated deployment and orchestration of the
containerized MQTT broker implementations, with support for deployment across
either moderately powerful AMD64 devices, or more resource constrained ARM64
devices. The proposed MQTT implementations are evaluated in terms of
performance offset response time and different payload sizes. Results showed
that the hardware platform used as well as the message size, and the network
parameters (latency, packet loss and jitter) have a significant impact on the
resulting performance of various broker implementations. All results, software
tools and code are fully reproducible and free and open source.

###### Index Terms:

IoT communication protocols, MQTT Brokers, Benchmarking

##  I Introduction

With the increasing expansion of Internet of Things (IoT) applications, a
significant number of efforts has been centered around the establishment of
effective communication patterns, choosing from various available standards,
frameworks, and communication protocols. Over the past years, a number of
application layer protocols, including Message Queuing Telemetry Transport
(MQTT), Constrained Application Protocol (CoAP), Hypertext Transfer Protocol
(HTTP), Extensible Messaging and Presence Protocol (XMPP), Advanced Message
Queuing Protocol (AMQP), and Data Distribution Service (DDS), have found their
use in IoT related system designs and solutions, without a single standard
that could fit all scenarios.

The choice of an application layer communication protocol is particularly
challenging when considering IoT edge/cloud computing systems, where
previously deployed cloud services (e.g., communication protocol’s
broker/server instances) can be located at the edge to support latency-
sensitive applications [1, 2]. Here, in addition to considering performance
aspects among different protocol solutions, the wide set of available
implementations for each protocol significantly impacts the understanding of
their appropriate utilization. Despite its known shortcomings, such as limited
scalability of centralized broker architectures or TCP based transport, MQTT
remains the currently most widely adopted publish/subscribe protocol. To us,
of special interest are open-source MQTT broker implementations and their
integration in edge network eco-systems. While multiple previous studies have
addressed various aspects of MQTT performance from the theoretical and
implementation perspective [3], as well as existing comparisons of different
MQTT brokers, works that integrate various MQTT broker implementations
experimentally in different network scenarios are few and far between. To the
best of our knowledge, ours is the first paper to address this practically
highly relevant method to performance analysis, especially in the edge
networking context.

We focus on performance benchmarks of five well known open source MQTT broker
implementations, including Mosquitto, EMQX, RabbitMQ, VerneMQ, and HiveMQ. To
this end, we implement an open source network testbed with an automated
execution of tests, which makes the entire environment easy to use, open to
extensions and fully reproducible. The engineered testbed interoperates with
various MQTT protocol frameworks, whose utilization can be of interest to both
researchers and developers. We use two machine setups; a cluster of three
virtual machines to measure the performance when typical AMD64 nodes are used,
as well as a cluster of three Raspberry Pis to analyze the performance if
these are replaced by less power-consuming ARM64 nodes. To compare the
performance of different broker implementations, we leverage different testbed
options for the configuration of its underlying network system, adjusting the
parameters network delay, variance and packet loss. The broker performance is
then benchmarked in terms of offset response time and message exchange latency
for different payload sizes. The work is truly in progress, allowing us to
analyze not only the performance, but also the choice of underlying hardware
platform, such as whether the brokers are supported on different CPU
architectures.

The rest of the paper is organized as follows. Section II presents the related
work. Section III describes the testbed and its configurations. Experimental
benchmarking tests and results are presented in Section IV. Section V
concludes the paper and provides an outlook.

##  II Related work

In the recent years, numerous efforts have been dedicated, by both the
research community and the industry, to investigate performance, evolution and
utilization of the MQTT protocol, as it still remains one of the most widely
adopted M2M/IoT protocol solutions. This includes various studies that
evaluate and compare different MQTT broker implementations based on their key
features [4]. Many efforts have also been directed towards different
benchmarking and evaluation methodologies for comparison of MQTT broker
performances in specific IoT scenarios [5]. Common evaluations also include
analyzing one or more MQTT broker implementations alongside the frameworks of
other IoT suitable communication protocols [6, 7]. Paper [8] compares the
message delivery time for five implementations ActiveMQ, Bevywise MQTT,
HiveMQ, Mosquitto and RabbitMQ, using a local deployment setup for the client
side, while running the brokers in the cloud, reporting a very small
difference in the obtained results. An extensive evaluation of popular message
brokers with MQTT support comparing Mosquitto, ActiveMQ, HiveMQ, Bevywise,
VerneMQ, and EMQX has been conducted in [9]. The study focused on two testing
environments; a local setup and a proprietary cloud solution, with Mosquitto
outperforming others for the most of the observed metrics. Paper [10] assesses
the performance of Mosquitto and RabbitMQ in a Smart City scenario, showing
the significant effect the choice of hardware platforms has on the
performance. While there is no lack of studies of different aspects of MQTT
communication in the cloud environments, particularly in terms of various
whitepapers provided by broker vendors, there are far less results in the edge
context. In [11], authors compare distributed MQTT brokers (EMQX, HiveMQ and
VerneMQ) in terms of scalability, with all three showing satisfying results.

Similar to related works, we also focus on comparing commonly used open source
MQTT broker implementations, but we focus on the choice of the solutions with
official containerization support (whether on only AMD64 or both AMD64 and
ARM64 nodes). In our case, we provide measurements within a network testbed
(and not on cloud only, or local machines), which is a novel contribution.

##  III Testbed

Fig. 1 shows the reference network testbed that we engineered for experimental
benchmarking of MQTT broker implementations. The hardware configuration of the
testbed mainly consists of three Raspberry Pis (ARM Cortex A72, 8GB) and one
server (Intel i9-10900X, 64GB), where we deploy three virtual machines (4vCPU,
8GB). We differentiate between two testbed setups, one in which MQTT brokers
are deployed across moderately powerful AMD64 devices (VM setup) and the other
one in which they are deployed across more resource constrained ARM64 devices
(RPi setup). Furthermore, we employ a testing machine (Intel i5-6500, 16GB),
and a Gigabit Ethernet switch through which all devices are interconnected.
The operating systems include Ubuntu version 22.04.2 for the tester, Ubuntu
20.04.6 for all Raspberry Pis (ARM64) and VMs (AMD64), and Arch Linux for the
server machine. It should be noted that we made use of a modified version of
an open source network testbed from [12]. While the original testbed design
was engineered to benchmark serverless functions, we removed the serverless
software framework and reused its existing network and hardware abstractions.
In this way, the present implementation is independent and can be deployed and
further developed as stand-alone open source MQTT broker testbed
implementation.

Figure 1: Testbed for experimental benchmarking of MQTT broker implementations

Since the common way of deploying MQTT brokers is through containers, we
deploy k3s - a lightweight Kubernetes distribution - as a container
orchestrator on top of the operating system. Across the respectively used
nodes (3 RPis or 3 VMs), a Kubernetes cluster is then formed with a single
master node and two worker nodes which handles the deployment and lifecycle
management of the brokers. As can be seen in Fig. 1, all five brokers have
official container images with AMD64 support available which are deployed on
our VM setup, while only three of them can be deployed on RPi setup. All nodes
considered in each setup are connected through a
Nebula111https://github.com/slackhq/nebula overlay network with established
virtual interfaces. Finally, we have the tester device running a local
container registry, testing tools and the test scheduler. The local container
registry contains the stable container images of the MQTT brokers for the
later deployment, while the main component of the tester - the test scheduler
- is in charge of executing the different benchmarking tests. For creating the
tests, we use an MQTT plugin for the JMeter load testing
tool222https://github.com/emqx/mqtt-jmeter. The test scheduler is also in
charge of orchestrating the testbed deployment, including the creation,
provisioning and destruction of required VMs, the setup of the overlay network
and the configuration of network parameters. Detailed instructions on the
testbed’s usage and deployment as well as running the various MQTT broker
implementations over the VM or RPi setup are available on
Github333https://github.com/michalke-it/benchmarking_os_mqtt_brokers_2023. All
results, software tools and code are fully reproducible and free and open
source.

###  III-A Broker implementations

Among the many MQTT broker options available, we opted for five open-source
MQTT broker implementations written in different programming languages as
depicted in Table I along with the officially supported protocol versions.

TABLE I: Proposed MQTT broker implementations Name | Language | ARM64 | MQTT 3.1.1 | MQTT 5.0
---|---|---|---|---
Mosquitto 444https://mosquitto.org/ | C | supported | supported | supported
EMQX555https://www.emqx.io/ | Erlang | supported | supported | supported
RabbitMQ666https://www.rabbitmq.com/ | Starlark | supported | supported | -
VerneMQ777https://vernemq.com/ | Erlang | - | supported | supported
HiveMQ888https://hivemq.com/ | Java | - | supported | supported

One of the selection criteria considered was the importance of ARM64
architecture support, which we consider a crucial feature for future edge
computing scenarios due to its high power efficiency. For this reason we opted
for brokers with official container images that support ARM64, which at the
moment includes only three implementations. Namely, these are the most popular
and widely used Mosquitto, the highly scalable EMQX, and RabbitMQ which was
initially designed for the AMQP protocol but also supports MQTT. In addition,
we benchmark two other implementations that have been used in distributed edge
computing; HiveMQ and VerneMQ [11]. Mosquitto, EMQX and RabbitMQ are analyzed
on the RPi setup, while all five brokers are analyzed on the VM setup..

###  III-B Network configuration scenarios

When it comes to the edge computing context, there is an additional dimension
to consider besides potentially different CPU architectures and capabilities
of hardware platforms; the QoS impacted by the different network parameters
between all nodes. To explore potential performance differences between the
brokers when this factor is considered, we run our tests over different
network configuration scenarios, designed to approximate real-world scenarios.
To do so, we modify the latency, jitter and packet loss of the
interconnections by applying the values to the virtual overlay network
interfaces. The exact values for the whole system are listed in Table II, with
each listed value representing the parameters that can be measured across the
connection of any two nodes of the network, as well as the connection of the
tester to any node. The values are defined based on the latency values
measured in [13] for edge data centers and the scenarios defined in [12].

TABLE II: QoS Parameters for Network configurations Scenario | Latency (ms) | Variance (ms) | Packet Loss (%)
---|---|---|---
local | 0 | 0 | 0
optimal | 2.5 | 0.5 | 0.04
worst | 6.25 | 1.25 | 0.1

According to these QoS parameters, we define three network scenarios in which
the broker implementations will be benchmarked: local, optimal, and worst
case. While the local scenario serves as a baseline without any additionally
introduced latency, variance or packet loss, the optimal scenario represents
what we consider an achievable best-case scenario for an edge computing
deployment with very low latency. The worst-case scenario on the other hand
represents the highest latency that could occur before a cloud deployment
would provide better service quality. It has to be noted that the listed
parameters are applied per direction.

###  III-C Testing

The testbed needs to be provided with configuration parameters specific to the
infrastructure and tests. This is achieved through the customization of the
config.yml file 999https://github.com/michalke-
it/benchmarking_os_mqtt_brokers_2023 for the parameter configuration, as well
as through population of the performance-tests folder with JMeter’s test
scripts. The important config.yml settings include:

  * •

_repository_ : our local container registry that hosts the broker images

  * •

_ports_ : the ports to be targeted for each test

  * •

_tests_ : the test(s) that should be ran in both setups (RP and VM)

  * •

_devices_ : the IP addresses and login names of the devices that form RP and
VM setup

  * •

_qos parameters_ : specifies different latency, packet loss and jitter values
for different network scenarios that are to be added to PM and VM network
interfaces

  * •

_software_ : the software versioning (Nebula, k3s, etc.)

  * •

_benchmark_ip_ : the IP address and ports to run the benchmarking tests
against

After provisioning all devices, the testbed waits for all deployments to
complete and then proceeds to run JMeter’s performance benchmarking tests.
This procedure is then repeated for all the different sets of QoS parameters
specified in the configuration while modifying the MQTT communication
parameters (number of publisher and subscriber threads, topics, messages to be
published, timeouts etc.) accordingly every time before the testing scripts
are executed, to measure performance offset, response time and latencies for
different message payload sizes. After configuration, the testbed waits or all
deployments to complete and then we proceeds to run JMeter’s benchmarking
tests for performance, modifying MQTT communication parameters for testing
scripts, which are to measure performance offset response time and latencies
for different message payload sizes.

##  IV Experimental Benchmarking

(a)  Raspberry Pi setup

(b) Virtual Machine setup

Figure 2: Testbed performance offset

In this section, we describe the benchmarking tests conducted as well as the
measurements obtained. We define two types of tests, one that measures the
testbed performance offset and the other that measures the payload size
response time in terms of latency. The latter is calculated for the MQTT
publish/subscribe message exchange service, using MQTT protocol version 3.1.1.
We calculate the latency as the time elapsed from sending a message from the
MQTT publisher to the MQTT subscriber. As testing tool we use a JMeter MQTT
plugin with customized test plans. We consider two hardware setups for each
test, i.e., VM and RPi, for three different network scenarios, i.e., local,
optimal and worst-case. In each test, we use one subscriber thread and adjust
the number of publisher threads, with each publisher thread sending a single
message to the target broker. The published messages are set to include
timestamps, which are then subtracted from the corresponding timestamps on the
subscriber side. Each test is repeated at least 10 times to minimize the
potential margin of error and ensure reproducibility of the results.

###  IV-A Performance Offset

This initial measurement serves to evaluate the performance offset introduced
when publishing a simple hello world string to the MQTT brokers deployed on
the testbed. Here, we conduct two sets of measurements of the response time on
the subscriber side. In the first set, we analyze broker implementations with
official ARM64 container support (Mosquitto, EMQX and RabbitMQ). In the second
set, we compare all five of the initially selected implementations (Mosquitto,
EMQX, RabbitMQ, HiveMQ and VerneMQ). On the publisher side, we configure a
utilization value of 100 threads, each sending the same message with an
interval of 250ms. The QoS of both, i.e., the subscriber and the publisher, is
set to the reliable level 1, guaranteeing a successful message transfer to the
broker. It should be noted that neither the authentication nor the security
mechanism was implemented.

For the first set of measurements, the response time values for the brokers
running on the RPi setup are shown in Fig.2a with boxplot graphics showing the
median value for each of the broker as well as variations in the obtained
data. Here, we can see that the median value for the performance offset tests
is around 5 ms in the local scenario, 10 - 12 ms in the optimal scenario, and
18 - 19 ms in the worst-case scenario, for all implementations. The figure
also shows that the boxplots are almost of the same size for each network
scenario with low variation of the values. While Mosquitto seems to preform
slightly better, the comparable delays in all cases are very low and can be
considered negligible.

For the second set of measurements, the response time values for all five
brokers running on the VM setup are shown in Fig.2b. The median value for
performance offset is around 4.8 - 8 ms (local), 8 - 13 ms (optimal), and 11 -
18 ms (worst-case scenario), for all implementations. This case however shows
higher variation of the values, particularly in the worst-case scenario, and
especially for HiveMQ broker, which shows the highest deviation of all
brokers, even under comparably good conditions. This behavior becomes more
pronounced the worse the networking conditions become, notably exceeding the
other brokers’ deviations while maintaining a similar median response time.
The opposite effect can be observed with RabbitMQ broker, which shows slightly
elevated median response times while maintaining significantly more
predictable response times than the other brokers. When comparing the median
values of the three broker implementations that have been tested on both
setups in in Fig.2a and Fig.2b, we can also see a slightly lower response time
by roughly one ms which can be considered negligible. This difference can also
be traced back to the slight performance advantage that the VMs have over the
RPis since the VM’s inter-node traffic does not have to pass through a
physical network medium but remains in the same physical device instead.

###  IV-B Payload size

TABLE III: Payload size: latency median and IQR - Mosquitto, EMQX and RabbitMQ |  | Mosquitto | EMQX | RabbitMQ
---|---|---|---|---
|  | local | optimal | worst | local | optimal | worst | local | optimal | worst
1KB | RP | 5.39 - 1.00 | 10.67 - 1.00 | 18.60 - 2.00 | 6.04 - 0.25 | 11.54 - 1.00 | 18.93 - 2.00 | 7.00 - 1.00 | 12.00 - 1.00 | 19.87 - 2.25
VM | 3.94 - 0.00 | 8.59 - 2.00 | 15.23 - 6.00 | 4.24 - 0.00 | 9.14 - 3.00 | 15.25 - 7.00 | 4.83 - 1.00 | 9.65 - 3.00 | 15.59 - 6.00
10KB | RP | 10.68 - 1.00 | 15.91 - 1.00 | 24.90 - 2.00 | 11.44 - 2.00 | 16.56 \- 2.00 | 24.71 - 2.00 | 13.16 - 2.00 | 17.73 - 1.00 | 26.15 - 2.00
VM | 4.33 - 0.00 | 8.83 - 2.00 | 16.85 - 7.00 | 4.66 - 1.00 | 9.43 - 2.00 | 16.67 - 7.00 | 5.76 - 1.00 | 9.85 - 1.00 | 17.25 - 6.00
1MB | RP | 272.48 - 32.00 | 332.42 - 48.00 | 643.17 - 181.25 | 274.11 - 35.00 | 333.04 -49.00 | 641.02 - 193.75 | 297.74 - 53.00 | 379.31 - 55.00 | 679.16 - 167.00
VM | 66.27 - 13.00 | 153.96 - 75.00 | 437.10 - 388.25 | 65.2 - 14.00 | 149.60 - 69.25 | 418.81 - 356.50 | 71.97 - 13.00 | 161.38 - 64.25 | 429.83 - 379.50

For the payload tests, we also configure a utilization of 100 threads on the
publisher side, sending messages of different payload sizes with an interval
of 250ms. We modify the message size by defining strings of different fixed
lengths, considering 1KB, 10KB and 1MB sizes. Next, we measure latency on the
subscriber side for each payload size and for each broker implementation in
all three network scenarios, for the VM and for the RPi setup. The QoS of
both, the subscriber and publisher, remains on level 1.

For the first set of broker implementations tested on both setups, i.e., RPi
and VM, the median latency values and interquartile range (IQR), which shows
how spread the boxplot is, are shown in Table III, with their values in
milliseconds. When sending a 1KB message, the resulting median values in both
setups are very close in all three network scenarios, with negligible
differences between the broker implementations. Even the differences in terms
of latency values between the local and worst-case scenario (e.g., Mosquitto,
local median 5.39 ms and worst case median 18.6 ms) are quite low. If we
compare these median values with the ones obtained as performance offset and
shown in Fig.2a (e.g., approximately 4.8 ms and 17 ms median values for local
and worst case scenario for Mosquitto) we can see that the 1KB payload size
introduces a very low additional latency. The IQR values also are in a low
range, with slightly higher variance for the worst case network scenario of
RabbitMQ and EMQX implementations. Similar trends continue for 10KB message
size, with the expected increase of latency in all cases compared to 1KB
message size. This increase remains in the range of approximately 5 ms in all
scenarios and all implementations.

Figure 3: Payload size 1MB: RP setup vs VM setup

Moving to 1MB message size, we can observe significant performance
differences. First, when comparing the same broker implementations on the VM
and RPi setup, we can observe that in each broker implementation and in each
network scenario, VMs preform better with noticeably lower median response
times, as well as lower variance. The difference in latency between these two
hardware setups is approximately 200ms for all implementations, which can be a
limiting factor in low-latency demanding IoT applications, where MQTT is often
the protocol of choice. On the other hand, when comparing the median response
times for the same scenario on the RPi setup, e.g. 643.17 ms (Mosquitto),
641.02 ms (EMQX) and 679.16 ms (RabbitMQ) for the worst-case scenario, we can
see that the broker implementation itself does not play a key role in the
overall results. The same can be said for VM setup. Unlike for the small
payload sizes, in the case of 1MB, the IQR range is much higher, indicating a
higher variance of the obtained values.

The effect that the setup has on which the brokers were deployed is also
visually shown on the example of RabbitMQ broker in Fig. 3 for 1MB message
payload size. As it can be seen, the difference in the response time on VM and
RP setup is noticeable in each of the three network scenarios, and it plays
almost the same role as the degradation of QoS parameters in the scenarios
themselves.

TABLE IV: Payload size: latency median and IQR - HiveMQ and VerneMQ |  | HiveMQ
---|---|---
|  | local | optimal | worst
1KB | VM | 9.70 - 5.00 | 13.46 - 5.00 | 18.40 - 7.00
10KB | VM | 9.95 - 4.00 | 13.94 - 5.00 | 19.75 - 8.00
1MB | VM | 125.00 - 24.00 | 194.72 - 73.00 | 374.80 - 320.00
|  | VerneMQ
|  | local | optimal | worst
1KB | VM | 4.37 - 1.00 | 8.30 - 3.00 | 13.64 - 6.00
10KB | VM | 5.18 - 1.00 | 9.23 - 2.00 | 15.23 - 7.00
1MB | VM | 76.25 - 12.00 | 144.85 - 71.00 | 345.64 - 292.50

The median latency values and IQR for the remaining broker implementations,
which are tested only on the VM setup, are shown in Table IV. For 1KB message
we can see the same trend as in the previously discussed implementations, with
the median latency values slightly higher in the local network scenario for
HiveMQ implementation. If we compare these median values with the ones
obtained as performance offset and shown in Fig.2b (e.g., approximately 8 ms
and 18 ms median values for local and worst-case scenario for HiveMQ) we can
again see that 1KB payload size introduces negligible latency. The same trend
continues for 10KB message size, with the increase of latency compared to 1KB
message being less than 1 ms. Moreover, this result can be observed in all
five broker implementations tested on VM setup. As previously, the more
significant deteriorations in performances of both median latency value and
IQR range can be noticed with 1MB payload size. However, if we now compare all
median response times for the same scenario and the VM setup, e.g., 153.9 ms
(Mosquitto), 149.6 ms (EMQX), 161.38 ms (RabbitMQ), 194.72ms (HiveMQ) and
144.85 ms (VerneMQ) for optimal case scenario, we can see that the differences
are not very pronounces, with HiveMQ performing slightly worse than other
implementations. However, if we consider the worst-case scenario on the VM
setup, we can see a significant difference between the two additional brokers
VerneMQ and HiveMQ and the remaining brokers. Namely, their mean values of
345.64 ms (VerneMQ) and 374.80 ms (HiveMQ) are considerably lower than 429.83
ms (RabbitMQ), 418.81 ms (EMQX), and 437.10 ms (Mosquitto) scored by the
remaining brokers. This is especially interesting given that HiveMQ preformed
worse than the others when using smaller payloads.

##  V Conclusion and outlook

We experimentally benchmarked the performances of five open-source MQTT Broker
implementations. To this end, we engineered a network testbed in an edge
computing context with constrained devices. When analyzing performance offset
of the testbed itself, we found comparable response times for all brokers,
when deployed in the same network scenarios and on the same hardware platform
setup. In cases of small message payload sizes (up to 10KB), with degradation
of network conditions, a small latency increase has been noticed for each of
the broker implementations. In that case under the same conditions, the
latency differences between them could be considered negligible. Once the
message payload size increased to 1MB, the performance of all implementations
in all network scenario deteriorates in both the median latency and its
deviation. However, the largest performance differentiator has been in the
testbed’s hardware setup itself, with Virtual Machine (VM) setup resulting in
much lower response times than the Raspberry Pi setup.

The experiments were conducted as a support in the decision making process for
the most suitable broker implementation. We conclude that this decision has to
be made with strong consideration for the network environment and use cases,
e.g., how big the typical message sizes are. In future work, the performance
should also be explored in relation to the scalability throughput and the
number of concurrent publishers and subscribers. In addition, the engineered
open source network testbed can be further extended to include and benchmark
other MQTT broker implementations, as well as to integrate other communication
protocol broker frameworks, which can then be evaluated with additional tests
and scenarios.

## Acknowledgment

This work was partially supported by EU HORIZON research and innovation
program, project ICOS, Grant Nr. 101070177, and by European Commission under
the H2020-952644 contract for project FISHY.

## References

  * [1] D. N. Jha, K. Alwasel, A. Alshoshan, X. Huang, R. K. Naha, S. K. Battula, S. Garg, D. Puthal, P. James, A. Zomaya _et al._ , “Iotsim-edge: a simulation framework for modeling the behavior of internet of things and edge computing environments,” _Software: Practice and Experience_ , vol. 50, no. 6, pp. 844–867, 2020.
  * [2] S. N. Swamy and S. R. Kota, “An empirical study on system level aspects of internet of things (iot),” _IEEE Access_ , vol. 8, pp. 188 082–188 134, 2020.
  * [3] A. Jukan, X. Masip-Bruin, J. Dizdarević, and F. Carpio, “Lab 2—connecting iot and edge with mqtt,” in _Network of Things Engineering (NoTE) Lab_. Springer, 2023, pp. 73–95.
  * [4] B. Mishra and A. Kertesz, “The use of mqtt in m2m and iot systems: A survey,” _IEEE Access_ , vol. 8, pp. 201 071–201 086, 2020.
  * [5] I.-D. Gheorghe-Pop, A. Kaiser, A. Rennoch, and S. Hackel, “A performance benchmarking methodology for mqtt broker implementations,” in _2020 IEEE 20th International Conference on Software Quality, Reliability and Security Companion (QRS-C)_. IEEE, 2020, pp. 506–513.
  * [6] S. Herrnleben, M. Leidinger, V. Lesch, T. Prantl, J. Grohmann, C. Krupitzer, and S. Kounev, “Combench: A benchmarking framework for publish/subscribe communication protocols under network limitations,” in _Performance Evaluation Methodologies and Tools: 14th EAI International Conference, VALUETOOLS 2021, Virtual Event, October 30–31, 2021, Proceedings_. Springer, 2021, pp. 72–92.
  * [7] E. Al-Masri, K. R. Kalyanam, J. Batts, J. Kim, S. Singh, T. Vo, and C. Yan, “Investigating messaging protocols for the internet of things (iot),” _IEEE Access_ , vol. 8, pp. 94 880–94 911, 2020.
  * [8] B. Mishra, “Performance evaluation of mqtt broker servers,” in _Computational Science and Its Applications–ICCSA 2018: 18th International Conference, Melbourne, VIC, Australia, July 2–5, 2018, Proceedings, Part IV 18_. Springer, 2018, pp. 599–609.
  * [9] B. Mishra, B. Mishra, and A. Kertesz, “Stress-testing mqtt brokers: A comparative analysis of performance measurements,” _Energies_ , vol. 14, no. 18, p. 5817, 2021.
  * [10] D. L. de Oliveira, A. F. da S. Veloso, J. V. V. Sobral, R. A. L. Rabêlo, J. J. P. C. Rodrigues, and P. Solic, “Performance evaluation of mqtt brokers in the internet of things for smart cities,” in _2019 4th International Conference on Smart and Sustainable Technologies (SpliTech)_ , 2019, pp. 1–6.
  * [11] H. Koziolek, S. Grüner, and J. Rückert, “A comparison of mqtt brokers for distributed iot edge computing,” in _Software Architecture: 14th European Conference, ECSA 2020, L’Aquila, Italy, September 14–18, 2020, Proceedings 14_. Springer, 2020, pp. 352–368.
  * [12] F. Carpio, M. Michalke, and A. Jukan, “Benchfaas: Benchmarking serverless functions in an edge computing network testbed,” _IEEE Network_ , 2022.
  * [13] B. Charyyev, E. Arslan, and M. H. Gunes, “Latency comparison of cloud datacenters and edge servers,” in _GLOBECOM 2020-2020 IEEE Global Communications Conference_. IEEE, 2020, pp. 1–6.